Executing Python scripts in Python?

Manuel Ruiz mruiz at safa.es
Tue Mar 25 06:15:23 EST 2003


El Tue, 25 Mar 2003 08:13:41 +0000, Richard escribió:

Hi,

Python has several way of execute other python code. Take a look at
eval(), exec and execfile() in you python documentation.

If you have problems understanding this functions don't hesitate and contact
with me by email.

Regards
Manuel Ruiz

> Hi,
> 
> I am currently writing an application in Python that (amongst other things)
> processes incoming data from multiple socket network connections. The
> incoming data on each socket is in a different format, although they all
> convey the same data.
> 
> I want my Python program to execute other Python scripts (in threads),
> passing to them (or making available to them) an object containing a
> connected socket and a ton of data fields for it to populate from the
> received (and processed) socket data. These scripts cannot be hard-coded
> into the appliocation as I need to be able to change the scripts while the
> main program is running.
> 
> I have seen in the Python Library Reference the 'code' module and think that
> this might be able to help me. However I can't find any examples of its use
> that applies to my situation.
> 
> Has anyone got any ideas?
> 
> Thanks
> 
> Richard





More information about the Python-list mailing list