Fixing except clause for Python3