Fix syntax of 'except' clause for compat with Python 3