can't find win32api from embedded pyrun call
Miki
miki.tebeka at gmail.com
Tue Jun 20 00:43:13 EDT 2006
Hello Jim,
> // 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?
IIRC you need to set the path explicitly in an embedded interpreter.
See the code in "site.py" (which again IMO is *not* imported when the
interpreter starts).
HTH,
Miki
http://pythonwise.blogspot.com/
More information about the Python-list
mailing list