Start a python interactive shell from python.

Bo Peng bpeng at rice.edu
Thu Jan 26 11:48:28 EST 2006


Dear list,

This may sound strange but I need to start a python shell from python. 
The motivation is that I have a bunch of (numeric) python functions to 
provide to a user. The best way I can think of is packing my python 
module using py2exe, and because it is easiest to let him run the 
functions through python syntax, I would like to start a python shell 
after the module is loaded.

Something like:

def myfunc(a):
   pass

if __name__ == '__namin__':
   ' myfunc has been defined '
   START A PYTHON SHELL?

so the user can type myfunc(0.5) and others. I can of course use 
raw_input and eval but I will lose the convenience of a real shell.

Many thanks in advance.
Bo



More information about the Python-list mailing list