embedding python -- windows specify problems

John Pye john+news at curioussymbols.com
Thu Oct 5 05:17:22 EDT 2006


Hi all

I have been working on some new code that embeds python in an C 
application. The embedding is working fine under Linux but crashing 
under Windows (XP) when I reach the following step.

PyRun_AnyFile(f,name);

If there's some python exception being thrown by the PyRun_AnyFile call, 
how can I retrieve it from C?

Even when the file (f) being run by Python contains only a 'print' 
statement, the application still crashes on WinXP. The linking to Python 
seems to be working OK, and the following C code that precedes the above 
PyRun_AnyFile statement seems to be working fine:

PyRun_SimpleString("import ascpy");
PyRun_SimpleString("L = ascpy.Library()");
PyRun_SimpleString("print L");

Can anyone suggest what some good diagnostic steps would be?

My embedding code is at the following link. I'm happy to explain the 
architecture in more detail if that helps.
https://pse.cheme.cmu.edu/svn-view/ascend/code/branches/extfn/models/johnpye/extpy/

Any suggestions very much appreciated!

Cheers
JP



More information about the Python-list mailing list