embedding python -- windows specify problems
fredrik at pythonware.com
Thu Oct 5 11:55:08 CEST 2006
John Pye wrote:
> 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.
> 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 contents and the layout of the FILE structure isn't defined, so PyRun_AnyFile()
only works if you make sure to open the file using *exactly* the same run time library
as Python itself uses.
it's usually easier to hand the problem over to the interpreter:
the same approach can be used to implement custom error handling, stdout/stderr
More information about the Python-list