PythonInit.cc 387 B

12345678910111213141516171819202122232425262728293031
  1. #include <boost/python.hpp>
  2. #include "Python/PythonInit.h"
  3. namespace Egametang {
  4. PythonInit::PythonInit()
  5. {
  6. Py_InitializeEx(0);
  7. }
  8. PythonInit::~PythonInit()
  9. {
  10. Py_Finalize();
  11. }
  12. bool PythonInit::IsInitialized()
  13. {
  14. return Py_IsInitialized();
  15. }
  16. const char* PythonInit::Version()
  17. {
  18. return Py_GetVersion();
  19. }
  20. void PythonInit::PrintError()
  21. {
  22. PyErr_Print();
  23. }
  24. } // namespace Egametang