Message86287
> i think it's all about the difference betwin print(msg) and
> sys.stdout.write('%s\n' % msg)
Yes. Actually, it's about what streams will accept. For example, a
stream opened with codecs.open(encoding='cp1251') will accept a Unicode
string and encode it before output. Likewise, a StringIO wrapped inside
a writer obtained from the codecs module.
However, stdout and stderr are of type file and seem to behave
differently - they behave as expected if I encode the value written to
them, but fail if I write a Unicode string to them.
I don't think special-casing for sys.stdout and sys.stderr in the
logging code is the correct approach. Better to put a conditional
encoding step when it's needed - now I just need to figure out all the
cases when it's needed ;-) |
|
Date |
User |
Action |
Args |
2009-04-22 11:35:19 | vinay.sajip | set | recipients:
+ vinay.sajip, shamilbi |
2009-04-22 11:35:18 | vinay.sajip | set | messageid: <1240400118.88.0.695125715467.issue5170@psf.upfronthosting.co.za> |
2009-04-22 11:35:17 | vinay.sajip | link | issue5170 messages |
2009-04-22 11:35:17 | vinay.sajip | create | |
|