gustafbstrom gustafbstrom - 9 months ago 39
Python Question

python3 messes up terminal

I'm in Mac OS X 10.10, using

installed using Macports.

There is something really strange going on when I start the interactive
shell. When starting
and runs anything (even non-syntactical commands), something happens to the terminal such that

  1. I cannot see any newlines while hitting Enter

  2. Anything I write doesn't show while typing, but will still be executed when hitting Enter.

This problem persists in the underlying
shell, after closing the
shell (using e.g. Ctrl-D). What makes this even "funnier" is that starting regular
afterwards (version 2.7 by the way), the problem solves itself – the terminal behaves as it should.

Has anyone seen this, has any suggestion what might have happened and hopefully knows a way to resolve this? Thank you.

Answer Source

Yep, I see this problem too using python3.5 on Mac OS X 10.10.

This seems to be a bug with the python3 interactive shell - it disables echo for your terminal and does not enable it when you exit(). To fix your terminal, run this command at the bash prompt.

stty echo

Credit goes to this post.

This bug is tracked here:
The permanent fix is to install the port py35-readline.

sudo port install py35-readline