Message125152
Peter, it seems that detach is relatively new (3.1) likely the code samples and suggestions that I had found to cure the problem predate that. While I haven't yet tried detach, your code doesn't seem to modify stdin, so are you suggesting, really...
sys.stdin = sys.stdin.detach()
or maybe
if hasattr( sys.stdin, 'detach'):
sys.stdin = sys.stdin.detach()
On the other hand, if detach, coded as above, is equivalent to
if hasattr( sys.stdin, 'buffer'):
sys.stdin = sys.stdin.buffer
then I wonder why it was added. So maybe I'm missing something in reading the documentation you pointed at, and also that at http://docs.python.org/py3k/library/io.html#io.TextIOBase.detach
both of which seem to be well-documented if you already have an clear understanding of the layers in the IO subsystem, but perhaps not so well-documented if you don't yet (and I don't).
But then you referred to the platform-dependent stuff... I don't see anything in the documentation for detach() that implies that it also makes the adjustments needed on Windows to the C-runtime, which is what the platform-dependent stuff I suggested does... if it does, great, but a bit more documentation would help in understanding that. And if it does, maybe that is the difference between the two code fragments in this comment? I would have to experiment to find out, and am not in a position to do that this moment. |
|
Date |
User |
Action |
Args |
2011-01-03 03:44:59 | v+python | set | recipients:
+ v+python, gvanrossum, barry, amaury.forgeotdarc, ggenellina, giampaolo.rodola, eric.araujo, r.david.murray, oopos, tercero12, tcourbon, tobias, flox, pebbe, quentel, erob |
2011-01-03 03:44:59 | v+python | set | messageid: <1294026299.28.0.586200957813.issue4953@psf.upfronthosting.co.za> |
2011-01-03 03:44:56 | v+python | link | issue4953 messages |
2011-01-03 03:44:55 | v+python | create | |
|