Please use Python 3 syntax (backported to Python 2.6 and 2.7), `except ImportError as ie`, http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception