Can my python script return a value to the c program executing it?

Philippe Martin pmartin at snakecard.com
Sat Apr 22 16:55:07 EDT 2006


Like this ?


http://aspn.activestate.com/ASPN/Mail/Message/python-list/1304518


Philippe



vduber6er wrote:

> I have a C program that calls my python script by
> 
> exec_pycode(code);
> 
> code =  "import CheckFasta\nCheckFasta.CheckFasta (\"sampledata.txt\",
> %d)\n", PyNum);
> 
> CheckFasta.py is my python script with a def CheckFasta in it that
> returns a string.
> 
> Is there a way for my C code to get the return value from CheckFasta?
> 
> Example:
> If CheckFasta returns "hello world"
> 
> can I somehow do something like
> 
> returnstring = exec_pycode(code);
> 
> where returnstring will contain "hello world" after the line above?
> 
> Thanks




More information about the Python-list mailing list