TypeError: __repr__ returned non-string (type bytes) #55
Comments
Hi @tchakravarty, I haven't seen this issue before. I use IPython quite a lot myself and haven't seen this. Are you using an IPython shell (i.e., Let me know if you find anything. Thanks, |
Hi @rodneykeeling, I am using the IPython console from within PyCharm. But please note that Martijn Pieters is claiming that this is a bug over on SO, and he is not often wrong... :-) |
Ah, I see. I am still primarily using Python 2.7.9. I added those Thanks, |
Not very elegant, but something like this should work: r = ... # create something with unicode
if sys.version_info[0] < 3:
return r.encode('utf-8')
return r UTF-8 will not always be the right encoding, especially on Windows, but if it's mostly ascii characters you can get away with it. |
@takluyver Yeah, creating a method that does that in one of the parent classes seems like the least intrusive option since there are so many |
Got a PR up here #56. Would love it if someone could test it. I tried it using Python 2.7.9 and 3.4.0 and it seems to work fine. |
Here is a minimal example of my attempts to interact with the Discogs API:
The functions
provide_discogs_auth
andprovide_verifier
simply return the consumer key & secret and the verifier from user authorization.get_access_token
returns the access key and secret as expected.However, on the last line, when I make an API call, I get:
Not sure if this is related to IPython or the client library, but would appreciate help either way. Thanks.
The text was updated successfully, but these errors were encountered: