Refactored for native python3 support (maintain python2 support with version detection) #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The same script can now be run on Python 2 and Python 3
Main issues between Python 2.x and Python 3.x on this script are the handling of bytes/strings and the print statements.
Changes made:
There are no changes to the functionality of the script. You can run it with exactly the same arguments as you could before. Should be more or less a drop in replacement for everyone as long as the print statement formatting doesn't screw things up for you. It also allows for people to use this script with Python 3 in the future.
If you don't like the giant if statement you can choose which functions you want depending on the version you are using and delete the other one in your own projects. First set of encode/decode is for python3 the second set is for python 2