Tab Stop Using Python Cmd.cmd

After testing the time with the Cmd.cmd framework in python, I noticed a problem that I don't know what to do about. Plus, I find this work a few hours before (or I'm just crazy), so it's even weirder.

I have the following sample code tested on both Windows and Linux systems (so this is not a Windows problem), but the tab just doesn't work.

If I use the same code in Python 2, it works on a Linux system (but not on Windows, though)

import cmd
class Shell ( cmd.Cmd ):    
    def do_test ( self, params ):
        print( 'test: ' + params )

    def do_exit ( self, params ):
        return True

    def do_quit ( self, params ):
        return True

if __name__ == '__main__':
    x = Shell()
    x.cmdloop()

Do you know why this is happening, or what can I do to make tab completion possible?

+5
source share
3 answers

Linux Python 2, 3. python readline, cmd. , Linux Python 3 .

, readline Unix-. python Windows Windows.

+5

Mac GNU.
pip install gnureadline.
Python 2.6, 2.7, 3.2 3.3.

0
source

All Articles