how to use "exec" stmt to get input from user

R

Rick King

I have a cmd.py-derived program (with a wxPython GUI) and want to
execute python statements for lines that are not my own special commands.

So basically it's either:

def do_somecommand(self,arg):
...

or

def default(self,arg):
exec arg in globals(),self.cmdlocals

(where cmdlocals is a my local dictionary)

in default() I'd like to be able to execute any python statement
including something like

"x = raw_input('>')"

when I do this though it goes to the command window and so any user of
the program would be confused, which also means I have to have a command
window.

If I add this:

self.stdin = self.edt_console_input (where self.edt_console_input
is a wxPython text control)

it just gets an EOF right away.

Is there any way to do what I want to do? This might be better posted on
the wxpython list.

Thanks for any help!

Rick King
Southfield MI
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top