Execute external code and get return value
Michele Petrazzo
michele.petrazzoDELETE at DELETEunipex.it
Fri Sep 29 08:22:55 EDT 2006
Hi,
I want to execute an external code, that become from a text file (pe),
call a function inside it and get its return value:
# ext_code.txt
def funct2Call():
return True
# test.py
sourcecode = open("ex_code.txt").read()
comp_code = compile(sourcecode, "My_test", "exec")
#do something like this
return_value = comp_code.funct2Call()
But I can't...
I find this:
http://tinyurl.com/nwbpk
but here, it call from the external code a function inside my code. I
want the opposite!
Is there a solution for do this?
Thanks,
Michele
More information about the Python-list
mailing list