lucjon / Py-StackExchange

A Python binding for the StackExchange API
http://stackapps.com/questions/198/py-stackexchange-an-api-wrapper-for-python
BSD 3-Clause "New" or "Revised" License
229 stars 76 forks source link

Update to support Python 3.5 #40

Closed dalanmiller closed 9 years ago

dalanmiller commented 9 years ago

Coming across this error when installing and using Python 3.5:

Traceback (most recent call last):
  File "so_monitor.py", line 17, in <module>
    print(message.format(**question.__dict__))
  File "/Users/dalanmiller/repos/SO_monitor/lib/python3.5/site-packages/stackexchange/__init__.py", line 543, in __str__
    return str(unicode(self))
NameError: name 'unicode' is not defined

Adding a hack such as:

import builtins
builtins.unicode = str

Results in:

...

    return str(unicode(self))
  File "/Users/dalanmiller/repos/SO_monitor/lib/python3.5/site-packages/stackexchange/__init__.py", line 543, in __str__
    return str(unicode(self))
  File "/Users/dalanmiller/repos/SO_monitor/lib/python3.5/site-packages/stackexchange/__init__.py", line 543, in __str__
    return str(unicode(self))
  File "/Users/dalanmiller/repos/SO_monitor/lib/python3.5/site-packages/stackexchange/__init__.py", line 543, in __str__
    return str(unicode(self))

...

RecursionError: maximum recursion depth exceeded

EDIT:

I see what is actually happening and why it's an infinite loop. Trying to port this portion of the code to be Python 3 compatible.

dalanmiller commented 9 years ago

Fixed with #41