Browse Source

Guard against sys.getfilesystemencoding() == None (#503)

Philipp Hagemeister 12 years ago
parent
commit
6df40dcbe0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      youtube_dl/utils.py

+ 4 - 1
youtube_dl/utils.py

@@ -409,7 +409,10 @@ def encodeFilename(s):
         # match Windows 9x series as well. Besides, NT 4 is obsolete.)
         # match Windows 9x series as well. Besides, NT 4 is obsolete.)
         return s
         return s
     else:
     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):
 class ExtractorError(Exception):