From 7c67143181b243bb562c83312c7b008a3edb955a Mon Sep 17 00:00:00 2001 From: Dustyn Gibson <miigotu@gmail.com> Date: Sun, 22 Nov 2015 14:31:52 -0800 Subject: [PATCH] Encode to SYS_ENCODING before os.walk or os.stat Fixes https://github.com/SickRage/sickrage-issues/issues/12 --- sickbeard/helpers.py | 4 ++-- sickbeard/postProcessor.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 4bb89db15..ad50403e0 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -747,7 +747,7 @@ def chmodAsParent(childPath): parentPathStat = os.stat(parentPath) parentMode = stat.S_IMODE(parentPathStat[stat.ST_MODE]) - childPathStat = os.stat(childPath) + childPathStat = os.stat(childPath.encode(sickbeard.SYS_ENCODING)) childPath_mode = stat.S_IMODE(childPathStat[stat.ST_MODE]) if os.path.isfile(childPath): @@ -792,7 +792,7 @@ def fixSetGroupID(childPath): if parentMode & stat.S_ISGID: parentGID = parentStat[stat.ST_GID] - childStat = os.stat(childPath) + childStat = os.stat(childPath.encode(sickbeard.SYS_ENCODING)) childGID = childStat[stat.ST_GID] if childGID == parentGID: diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index b71445381..ab01e21d2 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -158,7 +158,7 @@ class PostProcessor(object): """ def recursive_glob(treeroot, pattern): results = [] - for base, _, files in os.walk(treeroot): + for base, _, files in os.walk(treeroot.encode(sickbeard.SYS_ENCODING)): goodfiles = fnmatch.filter(files, pattern) results.extend(os.path.join(base, f) for f in goodfiles) return results @@ -968,7 +968,7 @@ class PostProcessor(object): [show.indexerid, show.indexer]) # If the file season (ep_obj.season) is bigger than the indexer season (max_season[0][0]), skip the file if int(ep_obj.season) > int(max_season[0][0]): - self._log(u"File has season %s, while the indexer is on season %s. The file may be incorrectly labeled or fake, aborting." + self._log(u"File has season %s, while the indexer is on season %s. The file may be incorrectly labeled or fake, aborting." % (str(ep_obj.season), str(max_season[0][0]))) return False -- GitLab