It happens that if your code throws an exception at runtime and that your completion does not work, you do not know why, because the trace is not printed. Try this very short code to understand what I mean: the program should crash on the c = 2+ "ddda" line, obviously you are adding a line and int that just don't work. But instead of crashing, the exception seems to be caught, and you have no idea what is going on. The program continues to work as if nothing was happening.
import cmd
class App(cmd.Cmd):
def complete_foo(self,*arg):
c = 2 + "ddda"
return "d dzpo idz dza dpaoi".split(" ")
def do_foo(self,*args):
print "foo"
App().cmdloop()
My question is: how to show an error when it is? (when using the cmd module).
source
share