diff --git a/xmlrunner/result.py b/xmlrunner/result.py index 1b7cce6..62b97b6 100644 --- a/xmlrunner/result.py +++ b/xmlrunner/result.py @@ -693,6 +693,8 @@ def _exc_info_to_string(self, err, test): msgLines.append(STDERR_LINE % error) # This is the extra magic to make sure all lines are str encoding = getattr(sys.stdout, 'encoding', 'utf-8') + if encoding is None: + encoding = 'utf-8' lines = [] for line in msgLines: if not isinstance(line, str):