Updating the utility to work with python3#6
Conversation
|
Is the idea to have 2 separate scripts in the repository: one for python2 and one for python3? |
|
That, or if statements could be put into the original script. That's probably a better solution. Iain Nash El Jun 17, 2012, a las 14:27, Tom Offermann reply@reply.github.com escribió:
|
|
I haven't worked with python3 at all, so this may be a dumb question... To write a single script that works with python2 and python3, is the usual technique to use if statements? So, the script would have an if statement like this every time there's a difference between the two (like print, or handling unicode): |
|
I took inspiration from bottle.py (https://raw.github.com/defnull/bottle/master/bottle.py) and redid the pull with ifs. Most of the issue was that strings by default are now unicode so str.decode() is unnecessary / doesn't work, along with switching the print statements. I can't fully test the python 2.7 script on my machine due to an older version of the sqlite binaries in my osx python distribution, but it runs up until fetching from the database fine. |
|
OK. Thanks for this. I like the idea of a single file much better, so let me look this over and do some testing before merging. |
|
No problem. |
Updating the utility to work with python3, mainly needed for updated sqlite on osx (otherwise get 'database encrypted error).