Execute external code and get return value
Michele Petrazzo
michele.petrazzoDELETE at DELETEunipex.it
Fri Sep 29 08:58:39 EDT 2006
Peter Otten wrote:
> Michele Petrazzo wrote:
>
>> I want to execute an external code, that become from a text file
>> (pe), call a function inside it and get its return value:
>
> namespace = {} execfile("ext_code.txt", namespace) print
> namespace["funct2Call"]()
>
Sorry, I forgot to say that "ext_code.txt" isn't a real file, but a text
become from a db, so or I create a temp file where I save the code and
pass its path to execfile, or use my post.
> Peter
Thanks,
Michele
More information about the Python-list
mailing list