aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-01-20 01:48:05 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-01-20 01:48:05 +0100
commit6df40dcbe0a0d6889fffbdc1dd7bf14452d3a605 (patch)
tree54f000bcf29dafe2f47a3ac4898182775c876639
parent97f194c1fbda1b88874ef4f05e2c5b3862d33f8f (diff)
Guard against sys.getfilesystemencoding() == None (#503)
-rw-r--r--youtube_dl/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 51c5ad920..532e8c782 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -409,7 +409,10 @@ def encodeFilename(s):
# match Windows 9x series as well. Besides, NT 4 is obsolete.)
return s
else:
- return s.encode(sys.getfilesystemencoding(), 'ignore')
+ encoding = sys.getfilesystemencoding()
+ if encoding is None:
+ encoding = 'utf-8'
+ return s.encode(encoding, 'ignore')
class ExtractorError(Exception):