J
Jim
I am trying to figure out how to embed Python in a little C++ Windows
console app. Here's the code:
// Py_Initialize();
Py_InitializeEx(0);
PyRun_SimpleString("from win32com.client import *");
Here's what it does on the last line:
File "D:\Python\Lib\site-packages\win32com\__init__.py", line 5, in ?
import win32api, sys, ok
ImportError: No module named win32api
The same line runs fine in IDLE or at the command prompt. It also runs
without complaint if I run a release version of the app. To build the
debug version I had to build python42_d.lib/dll myself. The reason I
can't call PyInitialize is that it crashes with an "invalid signal"
error.
I don't think it's a path issue -- I've checked system path, sys.path,
pythonpath env var, and the pythonpath entry in the registry, all of
them loaded with directories including the one with win32api.pyd.
Besides, if it were an install or path problem, why would it work at
the command prompt?
Could it be a problem with the debug lib I built? Any suggestions are
welcome.
-- Jim
console app. Here's the code:
// Py_Initialize();
Py_InitializeEx(0);
PyRun_SimpleString("from win32com.client import *");
Here's what it does on the last line:
File "D:\Python\Lib\site-packages\win32com\__init__.py", line 5, in ?
import win32api, sys, ok
ImportError: No module named win32api
The same line runs fine in IDLE or at the command prompt. It also runs
without complaint if I run a release version of the app. To build the
debug version I had to build python42_d.lib/dll myself. The reason I
can't call PyInitialize is that it crashes with an "invalid signal"
error.
I don't think it's a path issue -- I've checked system path, sys.path,
pythonpath env var, and the pythonpath entry in the registry, all of
them loaded with directories including the one with win32api.pyd.
Besides, if it were an install or path problem, why would it work at
the command prompt?
Could it be a problem with the debug lib I built? Any suggestions are
welcome.
-- Jim