Message255072
| Author |
jaraco |
| Recipients |
jaraco |
| Date |
2015年11月21日.22:01:42 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1448143303.11.0.840684568567.issue25692@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The built-in function 'input' appears to be sending the prompt to stderr instead of stdout, as the docs state it should.
$ python3.5 -c "print('stdout'); import sys; print('stderr', file=sys.stderr); input('foo')" 2> errors.txt
stdout
hello
$ cat errors.txt
stderr
foo
I've replicated this behavior in both Python 3.4 on Linux and Python 3.5 and 2.7 on OS X. Here's the 2.7 test/output:
$ python2.7 -c "from __future__ import print_function; print('stdout'); import sys; print('stderr', file=sys.stderr); raw_input('foo')" 2> errors.txt
stdout
hello
$ cat errors.txt
stderr
foo
I believe the stated behavior (outputting the prompt to stdout) is the proper behavior.
I figure I must be doing something wrong here, because it seems bizarre to me that this discrepancy hasn't been discovered before. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年11月21日 22:01:43 | jaraco | set | recipients:
+ jaraco |
| 2015年11月21日 22:01:43 | jaraco | set | messageid: <1448143303.11.0.840684568567.issue25692@psf.upfronthosting.co.za> |
| 2015年11月21日 22:01:43 | jaraco | link | issue25692 messages |
| 2015年11月21日 22:01:42 | jaraco | create |
|