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 martin.panter
Recipients Drekin, martin.panter, r.david.murray
Date 2015-08-25.22:28:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440541710.64.0.558012351771.issue24829@psf.upfronthosting.co.za>
In-reply-to
Content
In Linux, the original stdin, stdout, stderr file descriptors refer to the same console by default, and you use normal file reads and writes on them. In Linux when Python uses Gnu Readline, the displayed input characters are indeed written to the original stdout file descriptor. For comparison, when Readline is not used, the displayed characters go to the original stdin console, because they are handled at a lower OS level before they are even read by Python and Readline.

By experimentation, the Bash shell seems to work similarly, except it uses stderr rather than stdout. You can freely redirect stdout, but if you redirect stderr it affects the output seen on the terminal. It may be possible to write to stdin to avoid the input and output being split up, but I think writing to an input-only file descriptor is a bad idea.

If you dropped the isatty() check for stdout in Linux, you may end up with the output of Readline in the file (assuming Readline is okay with this). The file would include all the cursor positioning codes, backspaces, etc, that Readline generates. But I haven’t actually tried this.
History
Date User Action Args
2015-08-25 22:28:30martin.pantersetrecipients: + martin.panter, r.david.murray, Drekin
2015-08-25 22:28:30martin.pantersetmessageid: <1440541710.64.0.558012351771.issue24829@psf.upfronthosting.co.za>
2015-08-25 22:28:30martin.panterlinkissue24829 messages
2015-08-25 22:28:30martin.pantercreate