This should be a try/except instead of an if.