lukasschwab / stackit

StackOverflow queries from the command line
MIT License
314 stars 28 forks source link

Python34 compatibility #7

Closed WnP closed 9 years ago

WnP commented 9 years ago

Tested on python3.4 and python2.7.9

lukasschwab commented 9 years ago

@WnP thanks for the pull request!

I'm going to make some minor line comments in a moment but, as someone not super familiar with the changes between Python 2.7 and Python 3.3 // 3.4, I'd like a more detailed explanation of why these changes are necessary for forward-compatibility before I merge this pull request or evaluate it in detail.

Thanks!

WnP commented 9 years ago

for the first commit 88e2ecd this answer on stackoverflow should help you to understand the problem

for the second commit 1829ed8 this other answer on SO should help

lukasschwab commented 9 years ago

Re. commit 88e2ecd

@WnP I'm testing on python 2.7.6, and I'm getting an error:

  File "stackit/stackit_core.py", line 210, in <module>
    main()
  File "stackit/stackit_core.py", line 199, in main
    term = getTerm(parser)
  File "stackit/stackit_core.py", line 135, in getTerm
    term += (output.splitlines()[-1] + bytes(" ", "ascii"))
TypeError: str() takes at most 1 argument (2 given)

And accoding to this SO thread that makes sense––bytes functions like string and does not take encoding as an argument.

Maybe add a condition that checks the python version? I can't merge this as is.

WnP commented 9 years ago

@lukasschwab fixed

lukasschwab commented 9 years ago

Looks great, problem solved! Merging + adding README credits