4 Jun 2011 16:40
Tee encoding
engelbert gruber <grubert <at> users.sourceforge.net>
2011-06-04 14:40:07 GMT
2011-06-04 14:40:07 GMT
hei everyone,
while on bugfixtour in the manpage-writer alltests.py did report ::
======================================================================
ERROR: test_functional.py: functional/tests/standalone_rst_manpage.py
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/engelbert/projects/docutils/trunk/docutils/test/test_functional.py",
line 197, in test
diff = diff.encode(sys.stderr.encoding or 'ascii', 'replace')
AttributeError: Tee instance has no attribute 'encoding'
running functional alone reports the errors in manpage-writer.
my quick fix was ::
class Tee:
"""Write to a file and a stream (default: stdout) simultaneously."""
def __init__(self, filename, stream=sys.__stdout__):
self.file = open(filename, 'w')
self.stream = stream
+ self.encoding = stream.encoding
def write(self, string):
self.stream.write(string)
self.file.write(string)
(Continue reading)
RSS Feed