fix try/catch block for pypi (throws AttributeError instead of TypeError)