I have a script named main_test.py
, which has a syntax_error, is what I want to catch and show.
f = open(path, "r+"# )
And I try to import this in C++, code looks like below, already set path:
PyObject* pModule = PyImport_ImportModule("main_test");
I use PyErr_Print()
and PyErr_PrintEx(1)
to catch scripts errors.
Everything works fine in my centOS server with python3.6. But it does not work in my ubuntu docker, I cannot get anything from stderr to show.
What should I do?