Open
Description
Bug report
If stderr
is redirected, input()
doesn't print the prompt. The same happens when stdout
is redirected, but that is to be expected.
Code (in test.py
):
x = input('prompt: ')
print(x)
When run:
> python test.py
prompt: text
text
> python test.py >out
text
> python test.py 2>err
text
text
The contents of out
and err
, respectively:
# out
prompt: text
# err
prompt:
The first and second cases are as expected. In the last case, the prompt is not printed, even though it should go into stdout
, according to the documentation. Instead, it is printed to err
.
Your environment
- CPython versions tested on: 3.9.2
- Operating system and architecture: Linux 5.11.0-40-generic [backport to 2.7] Change documentation's
Show Source
link to GitHub #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux