What is your experience porting Python 2.7.x scripts to Python 3.x?

Schachner, Joseph Joseph.Schachner at Teledyne.com
Tue Jan 22 14:00:59 EST 2019


In the company I work for we have a program (free) that runs scripts (that we sell) to test according to particular standards.  The program embeds a Python interpreter, and the scripts are Python (which uses functions revealed to Python from within the program).

Well, this year must be time ... I've told my manager that we need to change from Python 2.7.13 (the last version to which I updated it) to Python 3.x, whatever the latest is, sometime this year and to get that on our roadmap. I should mention that updating from earlier 2.x versions through 2.7.13 has not caused any errors or problems in our scripts.  I guess that is as expected.

I've read about the 2to3 utility, and I think our Python code is pretty simple ... I don't expect much beyond changing print to print( ) wherever it occurs (we capture stdout and stderr and emit what we get to a file, that can be very helpful). There are Python function calls to C functions that are callable from Python in our program but that should not be a problem, they are known to be functions.  Still, I am concerned; I have never tried using 2to3 so I can't give a justifiable estimate of how long this migration might take.

For anyone who has moved a substantial bunch of Python 2 to Python 3,   can you please reply with your experience?  Did you run into any issues?   Did 2to3 do its job well, or did you have to review its output to eliminate some working but silly thing?

Thank you, anyone who replies, for replying.

--- Joseph S.



More information about the Python-list mailing list