changeset 839:c34c3c78eb3d

Allow missing encoding attribute on sys.stdout in case stdout has been replaced by, for example, a StringIO object (as is the case under nosetests).
author hodgestar
date Sun, 10 Oct 2010 21:54:09 +0000
parents 493e1ea770f0
children 2ea7bb126a96
files bitten/build/api.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/build/api.py
+++ b/bitten/build/api.py
@@ -44,7 +44,7 @@
     try:
         return text.decode('utf-8')
     except UnicodeDecodeError:
-        return text.decode(sys.stdout.encoding, 'replace')
+        return text.decode(getattr(sys.stdout, 'encoding', 'utf-8'), 'replace')
 
 
 class CommandLine(object):
Copyright (C) 2012-2017 Edgewall Software