Cameron Simpson wrote:
> On 04Jan2017 12:20, Cameron Simpson <[email protected]> wrote:
>>I will try to get a minimal example others can run.
>
> Well I've made some time for this, and it seems to be an interaction with
> my python3, the "input" builtin, and readline. Cmd.cmdloop behaves fine if
> I turn off the .raw_input attribute, and I can reproduce the issue without
> the cmd module.
>
> Test code:
>
> import readline
> line = input("F> ")
> print("gap")
> line = input("G> ")
If readline is not used input() writes its prompt to stderr. I don't have a
Mac, but it might be worthwhile to investigate what goes where. For
comparison here's what happens on my Linux system:
$ cat tmp.py
import sys
if "-r" in sys.argv:
import readline
print(
"uses readline" if "readline" in sys.modules
else "no readline"
)
line = input("F> ")
print("gap")
line = input("G> ")
$ python3 tmp.py
no readline
F> alpha
gap
G> beta
$ python3 tmp.py 2>/dev/null
no readline
alpha
gap
beta
$ python3 tmp.py -r 2>/dev/null
uses readline
F> alpha
gap
G> beta
--
https://mail.python.org/mailman/listinfo/python-list