Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add Python 3 compatibility #578
I've checked the Python 3.0 docs (https://docs.python.org/3.0/library/urllib.parse.html#urllib.parse.quote) and the 2to3 docs (https://docs.python.org/2/library/2to3.html#2to3fixer-urllib) and various random Google search results like this issue (pgbovine/OnlinePythonTutor#147) so am fairly confident in it applying to all of 3.x. Can't explain your original tests working though - I'm in the middle of a server rebuild so can't test it personally for a few days, but will then if you want.
OK. I've tested with 3.0 - the original script does fail as expected with the error importing urllib2. The script in this PR gets past that but then fails later for a different reason, a base64 error. After checking through release notes, it appears that was a core Python bug that was fixed in 3.1.3 (https://hg.python.org/cpython/raw-file/v3.1.3/Misc/NEWS issue 4768), and indeed that version works. So it looks like 3.1.3 is going to have to be the minimum Python 3 version for emails even after this PR. Supporting Python 3 versions only after 3.1.3 (8 years old) is better than none at all, I guess!