stringutils.py: tolerate sys.stdout having no 'encoding' attribute.
authordavid-sarah <david-sarah@jacaranda.org>
Sat, 26 Jun 2010 04:08:17 +0000 (21:08 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Sat, 26 Jun 2010 04:08:17 +0000 (21:08 -0700)
src/allmydata/util/stringutils.py

index 3e00f5d58982132645626f1a2dd152f37c1fb817..e09834044ed50ef189818b11ddea14071ebdcb7d 100644 (file)
@@ -41,7 +41,9 @@ def _reload():
 
     filesystem_encoding = _canonical_encoding(sys.getfilesystemencoding())
 
-    outenc = sys.stdout.encoding
+    outenc = None
+    if hasattr(sys.stdout, 'encoding'):
+        outenc = sys.stdout.encoding
     if outenc is None:
         try:
             outenc = locale.getpreferredencoding()