This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Drekin
Recipients Drekin, martin.panter
Date 2015-08-25.17:59:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440525541.52.0.36324225037.issue24829@psf.upfronthosting.co.za>
In-reply-to
Content
I really don't know how stdio in console in Linux works. In my package https://github.com/Drekin/win-unicode-console I set custom sys.std* streams and a custom readline hook to support Unicode in Python run in Windows console. If I run `py` with my fixes enabled, >>> "α" really yields "α", but when I run `py -i > output.txt`, >>> "α" yields "?" (written to the file of course) same as when my fixes are disabled. From this point of view it seemed wrong that redirection of output affects how a line is read.

Regarding the prompt, I think it should be always written to sys.stdout, so we may hypothetically add a wrapper around GNU readline writing the prompt to sys.stdout and calling the actual readline with empty prompt.

So you are telling me that the characters displayed in console when entering input are actually written to stdout in Linux (I think it's not the case in Windows)? Maybe it woudn't matter if they were written to console even when stdout is redirected.

I'm not saying it is extra useful to redirect stdout while providing interactive input, I was just wondering what should be the right behavior. And from my point of view motivated as explained above, readlinehook should be used even with redirected stdout, at least in Windows.
History
Date User Action Args
2015-08-25 17:59:01Drekinsetrecipients: + Drekin, martin.panter
2015-08-25 17:59:01Drekinsetmessageid: <1440525541.52.0.36324225037.issue24829@psf.upfronthosting.co.za>
2015-08-25 17:59:01Drekinlinkissue24829 messages
2015-08-25 17:59:01Drekincreate