debug_httperror raises UnicodeDecodeError because urllib2.URLError attribute contains bad encoding characters

Issue #48 resolved
created an issue

My locale is french, so when urllib2 can't connect to transmission rpc (for instance if the tcp port is closed), it raises URLError with the following reason (pasted from the debugger) :

[Errno 10061] Aucune connexion n�a pu �tre �tablie car l�ordinateur cible l�a express�ment refus�e

(which basically means 'Connection refused')

So when the transmissionrpc module calls debug_httperror with that reason, I end up with UnicodeDecodeError : File "C:\Python27\lib\json\", line 384, in _iterencode_dict yield _encoder(value) UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 18: invalid start byte

Full traceback is available at

I'm not sure which module is not correctly doing his job here, but I think it would be nice if debug_http could get over it and let TransmissionError be raised instead of UnicodeDecodeError ?

Comments (4)

  1. Erik Svensson repo owner
    • changed status to open

    From the error code I'm guessing that you are running on Windows? Might be some issue with localized error messages (Windows using multi-byte strings). I will see if I can reproduce something.

  2. Log in to comment