New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3 compatibility #578

Merged
merged 1 commit into from Nov 19, 2018

Conversation

Projects
None yet
2 participants
@sdchapman
Copy link
Contributor

sdchapman commented Nov 9, 2018

This should allow emails to be sent when using Python 3. Tested with 3.7.1

@hugbug

This comment has been minimized.

Copy link
Member

hugbug commented Nov 11, 2018

Thanks.
I believe I have tested the script with Python 3. Could it be that quote was moved to urllib.parse in more recent versions of Python? If that's the case the modified script will fail in older versions of Python 3. Can you please verify that?

@sdchapman

This comment has been minimized.

Copy link
Contributor Author

sdchapman commented Nov 11, 2018

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.

@sdchapman

This comment has been minimized.

Copy link
Contributor Author

sdchapman commented Nov 15, 2018

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!

@hugbug hugbug merged commit 458a1af into nzbget:develop Nov 19, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@hugbug

This comment has been minimized.

Copy link
Member

hugbug commented Nov 19, 2018

Thank you.
Would you like to provide a similar patch to Logger.py script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment