Why does the Python/C API crash on PyRun_SimpleFile?

后端 未结 7 737
一整个雨季
一整个雨季 2020-12-15 07:45

I\'ve been experimenting with embedding different scripting languages in a C++ application, currently I\'m trying Stackless Python 3.1. I\'ve tried several tutorials and exa

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 08:20

    And what about this solution:

    Py_SetProgramName(argv[0]);
    Py_Initialize();
    PyRun_SimpleString("execfile(\"ex30.py\")");
    Py_Finalize();
    

    Where ex30.py it the name of the python script I am running.

提交回复
热议问题