470,618 Members | 1,710 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,618 developers. It's quick & easy.

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

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

Apr 21 '06 #1
2 1171
Like this ?
http://aspn.activestate.com/ASPN/Mai...n-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


Apr 22 '06 #2
That link seemed to do the trick with a little bit of edits. Thanks a
lot Philippe!

Eric

Apr 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.