[Tutor] Identifying V3 examples

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Jul 22 15:52:10 CEST 2015


On 21/07/2015 21:19, Jon Paris wrote:
> The one example I specifically remember was this one http://code.activestate.com/recipes/532908-text-to-pdf-converter-rewrite/ - I happened to be looking for a simple pdf utility and this one was well reviewed. I subsequently have been told that the parts that 2to3 had trouble with were bad practice to begin with - but what do I know. Most of the other examples 2to3 converted (once I discovered it existed and how to use it in my setup) or I was able to decipher myself.

I've just run that recipe through 2to3 with no problem, so exactly what 
do you mean by "parts that 2to3 had trouble with"?

Possibly this?

-        except IOError, (strerror, errno):
-            print 'Error: Could not open file to read --->', self._ifile
+        except IOError as xxx_todo_changeme:
+            (strerror, errno) = xxx_todo_changeme.args
+            print('Error: Could not open file to read --->', self._ifile)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Tutor mailing list