Added: except Exception as e for python 3 compatibility