If I do it in CMD, it works without issues, but if I try it in Git Bash it doesn\'t work. I like to use Git Bash as my only console, but I can\'t do that if it doesn\'t work wit
Thanks for @darthfett 's answer, which largely solves the problem!
Just FYI: Same symptom also exists when your script is using import getpass; getpass.getpass()
, and in this case python -i your_script.py
will NOT fix it, but winpty python your_script.py
still works like a charm. (Lucky that they at least provide Winpty out of box with recent versions of Git For Windows.)
So, to setup once (per virtual environment) and forget it, you can append this line at the end of your env/Script/activate
:
alias python='winpty python.exe'
It will work in that bash console. (However, if you happen to be a vim user, it still won't work inside a vim when you do :python my_script.py
in vim.)