/Demo/embed/importexc.c

http://unladen-swallow.googlecode.com/ · C · 17 lines · 13 code · 4 blank · 0 comment · 0 complexity · a3ef144e6b0689cafdae58d167e029c8 MD5 · raw file

  1. #include <Python.h>
  2. char* cmd = "import exceptions";
  3. int main()
  4. {
  5. Py_Initialize();
  6. PyEval_InitThreads();
  7. PyRun_SimpleString(cmd);
  8. Py_EndInterpreter(PyThreadState_Get());
  9. Py_NewInterpreter();
  10. PyRun_SimpleString(cmd);
  11. Py_Finalize();
  12. return 0;
  13. }