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
Bug report
If
stderris redirected,input()doesn't print the prompt. The same happens whenstdoutis redirected, but that is to be expected.Code (in
test.py):When run:
The contents of
outanderr, respectively: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 toerr.Your environment
Show Sourcelink to GitHub #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux