The syntax except IOError, e:
is perfectly valid in Python 2.7. Are you sure you are getting that particular error under 2.7? You'd have to change it to this for Python 3.x: except IOError as e: But that would not be backwards compatible with 2.x. Using a tool like 2to3.py may help produce a version of the script that could run under Python 3.x. Best, BN