JohnDoee / deluge-client

A very lightweight pure-python Deluge RPC Client
MIT License
87 stars 14 forks source link

Non-string errors on python 3 #13

Closed gazpachoking closed 6 years ago

gazpachoking commented 6 years ago

RPC errors on python 3 come back as bytes, rather than strs, example:

deluge_client.client.b'BadLoginError': (b'Password does not match', b'localclient')

b'Traceback (most recent call last):\n  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0b2.dev37-py2.7.egg/deluge/core/rpcserver.py", line 248, in dispatch\n    ret = component.get(\'AuthManager\').authorize(*args, **kwargs)\n  File "/usr/local/lib/python2.7/dist-packages/deluge-2.0b2.dev37-py2.7.egg/deluge/core/authmanager.py", line 116, in authorize\n    raise BadLoginError(\'Password does not match\', username)\nBadLoginError: Password does not match\n'

The b'' and lack of literal newlines in traceback isn't so nice. Results should be decoded to strings before raising exceptions, for readability. (Testing on python 2 is also needed)

JohnDoee commented 6 years ago

Thanks for reporting it!