Commits

Erik Svensson committed c5237f6

Trying to fix error message encoding issue on Windows. Issue #48.

  • Participants
  • Parent commits cfd039f

Comments (0)

Files changed (1)

File transmissionrpc/client.py

 # Copyright (c) 2008-2013 Erik Svensson <erik.public@gmail.com>
 # Licensed under the MIT license.
 
-import re, time, operator, warnings, os
+import sys, re, time, operator, warnings, os
 import base64
 import json
 
     """
     Log the Transmission RPC HTTP error.
     """
+    if sys.platform == 'win32':
+        m = error.message.decode(sys.stdout.encoding)
+    else:
+        m = error.message
     try:
         data = json.loads(error.data)
     except ValueError:
                 'response': {
                     'url': error.url,
                     'code': error.code,
-                    'msg': error.message,
+                    'msg': m,
                     'headers': error.headers,
                     'data': data,
                 }