Running python apps from within python apps

Claudio Grondi claudio.grondi at freenet.de
Sat Jan 14 17:00:46 CET 2006


aph wrote:
> actually 'exec()' is the function I was looking for. Working code:
> 
> class myApp:
> 
>     def kalle(self,str):
>         return str.upper()
> 
>     def run_script(self,script):
>         exec(script)
> 
> app = myApp()
> app.run_script("print self.kalle('hello')")
> 
> Thanks...
> 
Sorry, I see, I should read your posting more carefully.

PyPy allows to run one Python interpreter in another Python interpreter 
and it should even be possible to switch from one to another on the fly 
- it is a bit more, than I can currently understand myself - it is a way 
beyond what exec() does just running any source code passed to it in the 
scope of the current script (and not the interpreter/application as such).

Claudio
P.S. my email directly to you bounced, because your mailbox reports to 
be full.



More information about the Python-list mailing list