From 367b5b21ff2aa72776d327286e6dd7fca9af59d8 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 30 Aug 2010 11:45:32 +0200 Subject: encoding fixes --- pyLoadCli.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'pyLoadCli.py') diff --git a/pyLoadCli.py b/pyLoadCli.py index 1bfae7238..bab5c360e 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -24,8 +24,6 @@ from itertools import islice import os import os.path from os.path import join -from os.path import abspath -from os.path import dirname import sys from sys import exit import threading @@ -34,14 +32,12 @@ from time import sleep import xmlrpclib from traceback import print_exc +from codecs import getwriter +sys.stdout = getwriter("utf8")(sys.stdout, errors = "replace") from module import InitHomeDir from module.ConfigParser import ConfigParser -import codecs - -sys.stdout = codecs.getwriter("utf8")(sys.stdout, errors = "replace") - if sys.stdout.encoding.lower().startswith("utf"): conv = unicode else: @@ -474,7 +470,7 @@ if __name__ == "__main__": config = ConfigParser() translation = gettext.translation("pyLoadCli", join(pypath, "locale"), languages=[config['general']['language']]) - translation.install(unicode=(True if sys.stdout.encoding.lower().startswith("utf") else False)) + translation.install(unicode=True) server_url = "" username = "" @@ -547,7 +543,6 @@ if __name__ == "__main__": server_url = "http%s://%s:%s@%s:%s/" % (ssl, username, password, addr, port) - print server_url if add: cli = pyLoadCli(server_url, add) else: -- cgit v1.2.3