I am new to Python and embedded python in general.
When trying to run some basic python commands from C ++, it seems that some of my imports do not work with C ++, but they work when I run them from the python shell.
These are the basic instructions I'm trying to run.
import sys
sys.path.insert(0, 'c:/svapp/')
sys.path.insert(0, 'c:/svapp/test')
from common import baseaccess
from debug.domains.pm import pm_tools
In my C ++ file, it looks like this:
int main(){
Py_SetProgramName("myPythonProgram");
Py_Initialize();
PyRun_SimpleString("import sys,os");
PyObject *sys_path = PySys_GetObject("path");
PyList_Append(sys_path, PyString_FromString("c:\\svapp"));
PyList_Append(sys_path, PyString_FromString("c:\\svapp\\test"));
PyObject * commonModule = PyImport_ImportModule("common");
PyObject * debugDomainsModule =
PyImport_ImportModule("debug.domains.pm.pm_tools");
}
The general modules seem to load just fine, but when I try to load debug.domains.pm.pm_tools, it imports some internal imports.
The error trace ends with:
The file "C:. \ Python27 \ lib \ site-packages \ namednodes__init __ py", line 30, in from. import options ImportError: cannot import name settings
Could you point me in the right direction? why does this only happen through a C ++ embedded application?
, .