Python 3 compatibility - Exception handling (remove unreferenced exception)