Skip to content Skip to sidebar Skip to footer

Pythons Console Module Has Made It Impossible To Type The Tab Key

I started using it on one of my programs a while back. Ever since, whenever I type the tab key on a console (cmd.exe instance) with python running, I get a readline internal error.

Solution 1:

Tested solution for Windows 10 (17 January 2020)

  • Copy last traceback file path C:\SP_CI_PROGRAMS\Languages\Python\3.6.1\Lib\rlcompleter.py
  • Open it with any text editor
    • If has VsCode use cmd and copy this
    • code C:\SP_CI_PROGRAMS\Languages\Python\3.6.1\Lib\rlcompleter.py
  • Look the line 80 which traceback tell us
  • Change these line (starts 79) like bellow and It will works
  • There will no error message and unnecessary tab more
...
if _readline_available:                  ## The old one is ##ifhasattr(readline, 'redisplay'):   # if _readline_available:
        readline.insert_text('\t')       #     readline.insert_text('\t')
        readline.redisplay()             #     readline.redisplay()return''# return ''
...

Do not forget to relaunch your python terminal

Solution 2:

Seems to be a continuing issue for Windows machines as seen on Github. A workaround seems to be uninstalling the pyreadline package.

Solution 3:

Stop using pyreadline. It's been abandoned. What you're seeing is a known issue, but unless someone takes over pyreadline development, it's unlikely to ever be fixed.

Solution 4:

pyreadline can be uninstalled by typing pip uninstall pyreadline in the command prompt. I was experiencing the same issue, but after uninstalling pyreadline, Tab key is working for me.

NOTE: To see the installed packages, type pip list in command prompt.

Solution 5:

Well if you don't have permission on the machine. You won't be able to do those uninstall solutions.

So set the completer function. It will solve the problem and won't have weird behaviors. But the auto-completion won't work anymore. If you want it to work have a look at the documentation and implement it.

readline.set_completer(lambda t, s: [None][s])

Post a Comment for "Pythons Console Module Has Made It Impossible To Type The Tab Key"