Reply to post:

For real this time, get your butt off Python 2: No updates, no nothing after 1 January 2020

Rudolph Hucker the Third
Boffin

I didn't get where I am today without being part of the "Statler and Waldorf" wing of El Reg. But my medication is working well today, so I will play-nice and share my top two tips for migrating production Python sites from 2.x to 3.x

1) Replace all PRINT with a wrapper function (say) PrintThis()

PrintThis() can then include a check on the config Development/Production status and switch accordingly.

Print to console is fine in Dev. But in Production, PrintThis() should switch output to Log files or a Log database (your choice)

2) For every INCLUDEd library in your 2.x code

On Linux:

sudo python3 pip -m install ThisLibrary

On Windows (e.g. in Visual Studio):

Switch the Python Environment to 3.x.

Use pip and search PyPI for each library, and install.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019