diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 21:27:11 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 21:27:11 +0200 |
commit | 52ac62d408dba48ad36744098003e47208c082c2 (patch) | |
tree | e882d1b1491423c85f345136fa9e464227e0dc77 /pyLoadCli.py | |
parent | web if acc settings (diff) | |
download | pyload-52ac62d408dba48ad36744098003e47208c082c2.tar.xz |
encoding fix try
Diffstat (limited to 'pyLoadCli.py')
-rwxr-xr-x | pyLoadCli.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pyLoadCli.py b/pyLoadCli.py index 36ab0c4f7..426cf6370 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -30,10 +30,15 @@ import threading import time from time import sleep import xmlrpclib +from traceback import print_exc from module import InitHomeDir from module.ConfigParser import ConfigParser +import codecs + +sys.stdout = codecs.getwriter("unicode")(sys.stdout, errors = "replace") + if sys.stdout.encoding.lower().startswith("utf"): conv = unicode else: @@ -109,7 +114,7 @@ class pyLoadCli: return conv(size / 1024 ** 2) + " MiB" def println(self, line, content): - print "\033[" + conv(line) + ";0H\033[2K" + conv(content) + "\033[" + conv((self.inputline if self.inputline > 0 else self.inputline + 1) - 1) + ";0H" + print "\033[" + conv(line) + ";0H\033[2K" + content + "\033[" + conv((self.inputline if self.inputline > 0 else self.inputline + 1) - 1) + ";0H" def print_input(self): self.println(self.inputline, white(" Input: ") + self.input) @@ -336,7 +341,7 @@ class RefreshThread(threading.Thread): self.cli.println(2, red(conv(e))) self.cli.pos[1] = 0 self.cli.pos[2] = 0 - + print_exc() |