From b8df25a8d1b63da19ce94705155dea87e4d927ae Mon Sep 17 00:00:00 2001 From: david-sarah Date: Fri, 25 Jun 2010 21:08:17 -0700 Subject: [PATCH] stringutils.py: tolerate sys.stdout having no 'encoding' attribute. --- src/allmydata/util/stringutils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/allmydata/util/stringutils.py b/src/allmydata/util/stringutils.py index 3e00f5d5..e0983404 100644 --- a/src/allmydata/util/stringutils.py +++ b/src/allmydata/util/stringutils.py @@ -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() -- 2.45.2