summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/Plugin.py2
-rw-r--r--module/setup.py2
-rwxr-xr-xpyLoadCli.py11
-rwxr-xr-xpyLoadCore.py7
4 files changed, 10 insertions, 12 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 1f680032a..8049da33f 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -255,7 +255,7 @@ class Plugin(object):
download_folder = self.config['general']['download_folder']
- location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding().replace(":", ""))) # remove : for win compability
+ location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()).replace(":", "")) # remove : for win compability
if not exists(location):
makedirs(location)
diff --git a/module/setup.py b/module/setup.py
index c1f449be4..937d7d91d 100644
--- a/module/setup.py
+++ b/module/setup.py
@@ -48,7 +48,7 @@ class Setup():
lang = self.ask("Choose your Language / Wähle deine Sprache", "en", ["en", "de"])
translation = gettext.translation("setup", join(self.path, "locale"), languages=[lang])
- translation.install(unicode=(True if sys.getfilesystemencoding().startswith("utf") else False))
+ translation.install(True)
print ""
print _("Welcome to the pyLoad Configuration Assistent.")
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:
diff --git a/pyLoadCore.py b/pyLoadCore.py
index a276d00eb..17865bfe0 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -64,6 +64,8 @@ import module.remote.SecureXMLRPCServer as Server
from module.web.ServerThread import WebServer
from module.FileDatabase import PyFile
+from codecs import getwriter
+sys.stdout = getwriter("utf8")(sys.stdout, errors = "replace")
class Core(object):
""" pyLoad Core """
@@ -179,7 +181,7 @@ class Core(object):
translation = gettext.translation("pyLoad", self.path("locale"),
languages=["en", self.config['general']['language']])
- translation.install(unicode=(True if sys.getfilesystemencoding().lower().startswith("utf") else False))
+ translation.install(True)
self.debug = self.doDebug or self.config['general']['debug_mode']
@@ -324,7 +326,8 @@ class Core(object):
if self.config['log']['file_log']:
file_handler = logging.handlers.RotatingFileHandler(join(self.config['log']['log_folder'], 'log.txt'),
maxBytes=102400,
- backupCount=int(self.config['log']['log_count'])
+ backupCount=int(self.config['log']['log_count']),
+ encoding="utf8"
) #100 kib each
file_handler.setFormatter(frm)
self.log.addHandler(file_handler)