In Python 3, when the server sends back an error and the client tries to raise an exception, this happens:
>>> from deluge_client import DelugeRPCClient
>>> c = DelugeRPCClient('10.0.3.3', 58846, 'wrong_username', 'wrong_password')
>>> c.connect()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mostafa/source/deluge-client/deluge_client/client.py", line 60, in connect
result = self.call('daemon.login', self.username, self.password)
File "/home/mostafa/source/deluge-client/deluge_client/client.py", line 102, in call
exception = type(exception_type, (Exception, ), {})
TypeError: type() argument 1 must be str, not bytes
This is due to the fact that rencode.loads function returns a bytes object in Python 3 not an str while the type function expects a string.
In Python 3, when the server sends back an error and the client tries to raise an exception, this happens:
This is due to the fact that
rencode.loads
function returns abytes
object in Python 3 not anstr
while thetype
function expects a string.