'unknown' command processing in python ?

rjain7 at yahoo.com rjain7 at yahoo.com
Tue Apr 11 19:40:38 EDT 2006


Hello,

I am a newbie; looking for an easy equivalent of TCL 'unknown' command
in python. My basic aim is to be able to pass any command which python
interpreter does not understand to my own C++ extension.

The two ways that I understand:

a) Extend cmd.Cmd() class: Will require me to write my own custom
interpreter, however I do not want to execute my own command loop;
rather retain existing user experience of python shell.

b) Handle NameError exception: looks like I'd need to extend cmd.Cmd()
class here as well...

If you know of a simple enough way, or a code snippet that achieves
similar purpose, I'd greatly appreciate it.

Thanks,
Rahul




More information about the Python-list mailing list