]> jfr.im git - z_archive/twitter.git/commitdiff
UTF-8 decode extra_args only if Py 2.7.
authorMike Verdone <redacted>
Sun, 27 Jan 2013 21:51:01 +0000 (22:51 +0100)
committerMike Verdone <redacted>
Sun, 27 Jan 2013 21:51:01 +0000 (22:51 +0100)
twitter/cmdline.py

index f586e4ae8b1eecf554246bf307bb13344ffa1475..fd062f098640325f8c4260afce3f4ebc3169405c 100644 (file)
@@ -132,8 +132,9 @@ def parse_args(args, options):
                  'datestamp', 'no-ssl', 'force-ansi']
     short_opts = "e:p:f:h?rR:c:l:td"
     opts, extra_args = getopt(args, short_opts, long_opts)
-    extra_args = [arg.decode(locale.getpreferredencoding())
-                  for arg in extra_args]
+    if extra_args and hasattr(extra_args[0], 'decode'):
+        extra_args = [arg.decode(locale.getpreferredencoding())
+                      for arg in extra_args]
 
     for opt, arg in opts:
         if opt in ('-f', '--format'):