python sub interpreter

Thomas Pollet thomas.pollet at gmail.com
Wed Feb 7 10:22:40 EST 2007


Hello,

I want to have a python interpreter shell spawn from a python class member
function.
atm I use exec but I want something more flexible (i.e. syntax checking
while typing)

E.g.:

class blah:

    def start_shell(self):
        import sys
        dbg=self
        str=""
        while str != 'exit':
            exec str
            print 'pydbg>>',
            str=sys.stdin.readline()

etc.

Somebody knows if something like this has been done before or an easy way to
go about this?

Regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070207/bb525c3e/attachment.html>


More information about the Python-list mailing list