PyRun_SimpleFile() crashes

lixinyi.23 at gmail.com lixinyi.23 at gmail.com
Wed Sep 24 04:04:43 EDT 2008


On 9月24日, 午後3:39, lixinyi... at gmail.com wrote:
> my code:
> main.cpp
> #include <Python.h>
>
> int main(int argc, char **argv)
> {
> Py_Initialize();
>
> FILE *file_1 = fopen("a2l_reader.py","r+");
> PyRun_SimpleFile(file_1,"a2l_reader.py");
>
> Py_Finalize();
>
> }
>
> compile under windows using MinGW:
> g++ main.cpp libpython25.a -o a
>
> no error was found. But when I run a.exe the program just crashes.
>
> What should I do?


PyRun_File  and PyRun_SimpleFile  would just crash my application.
but PyRun_SimpleString works fine.

But why???




More information about the Python-list mailing list