]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Guard against sys.getfilesystemencoding() == None (#503)
authorPhilipp Hagemeister <phihag@phihag.de>
Sun, 20 Jan 2013 00:48:05 +0000 (01:48 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sun, 20 Jan 2013 00:48:05 +0000 (01:48 +0100)
youtube_dl/utils.py

index 51c5ad9204d319de00cbbd7458d22cbdb1172cc5..532e8c7825066ef822506a7589f9d3f48163f1f8 100644 (file)
@@ -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):