Search code examples
pythoninterpretermacos-high-sierra

Python 3.6 interpreter refuses to input spaces unless I'm holding option


Instead of inputting the space, terminal acts as if I hit an invalid character (blinks and makes a sound effect). However, if I hold option while pressing space it works like normal (which turns out to be a non-breaking space). Everything is fine outside the interpreter, but within it only spaces refuse to input.

This occurs with Python 3.6.3 on macOS High Sierra. I can't pinpoint when exactly it started happening because I hadn't touched Python in a long time, but after updating to High Sierra and coming back to Python I noticed this problem. I have tried removing all PIP packages, reinstalling Python 2 and 3 to no avail.

Here is video: https://streamable.com/psy7p


Solution

  • Alright, I stumbled upon an answer finally after attempting to setup a postgres server and having the same issue in the interactive command mode.

    A long time ago I created an .inputrc file to use the Magic Space feature which overrides the space key to a magic-space, which only bash recognizes but otherwise mainly functions the same as a normal space. I had completely forgotten about this. I ended up wrapping this in a conditional, which fixes the space issue finally. I still wonder why Python 2.xx versions worked fine though.

    This answer was helpful:

    https://unix.stackexchange.com/questions/315137/i-cannot-type-space-in-interactive-command-mode