Does God “Look on Wickedness” or Not?

How could the prophet Habakkuk correctly say that God “cannot look on wickedness” if God knows and sees everything, including iniquity? How can God be of “purer eyes than to behold evil,” and yet allow Satan, “the evil one,” to come into His presence? Are these not contradictory Bible teachings?