> import sys > class ThreadedOut: > def __init__( self, old ): > self._old= old > def write( self, s ): > self._old.write( s ) > sys.stdout= ThreadedOut( sys.stdout ) > > Python 3.0a2 WinXP, on the console. 'a' is undeclared but error > message isn't thrown. With 'sys.stdout= Thr...' commented:
> stdout and stderr needn't be built-in file objects: any object is > acceptable as long as it has a write() method that takes a string > argument. Adding def flush( self ): self._old.flush() fixed it. Can we get that in the docs? -- http://mail.python.org/mailman/listinfo/python-list