From 607af5c2f5fc66166d29d1a770c8d5bda661590b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Sat, 28 Sep 2019 12:21:08 -0400 Subject: [PATCH] WIP --- bazarr/logger.py | 3 ++- bazarr/main.py | 3 +++ libs/pyprobe/pyprobe.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bazarr/logger.py b/bazarr/logger.py index 557e0cc18..20196d9e2 100644 --- a/bazarr/logger.py +++ b/bazarr/logger.py @@ -42,7 +42,8 @@ class NoExceptionFormatter(logging.Formatter): def configure_logging(debug=False): - warnings.simplefilter('ignore', category=ResourceWarning) + if six.PY3: + warnings.simplefilter('ignore', category=ResourceWarning) if not debug: log_level = "INFO" diff --git a/bazarr/main.py b/bazarr/main.py index fccb0f058..ef8d22a6e 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -61,6 +61,9 @@ from config import settings, url_sonarr, url_radarr, url_radarr_short, url_sonar from subliminal_patch.extensions import provider_registry as provider_manager from subliminal_patch.core import SUBTITLE_EXTENSIONS +if six.PY2: + reload(sys) + sys.setdefaultencoding('utf8') gc.enable() os.environ["SZ_USER_AGENT"] = "Bazarr/1" diff --git a/libs/pyprobe/pyprobe.py b/libs/pyprobe/pyprobe.py index 5afccfbe4..417961be2 100644 --- a/libs/pyprobe/pyprobe.py +++ b/libs/pyprobe/pyprobe.py @@ -176,7 +176,7 @@ class VideoFileParser: IOError: ffprobe execution failed """ - command = [parser] + commandArgs + [inputFile] + command = [parser] + commandArgs + [inputFile.encode(getfilesystemencoding())] if PY3: completedProcess = subprocess.run( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8"