Trying to execute some python in a Java program I have. This code
uses the win32com module to access a COM component. The interpreter
has no problem finding the win32com module (I set the python.path
on the command line when I start the JVM, -dpython.path).
When the win32com module is loaded it attempts to load win32api
module in another directory, and an exception occurs.
Here's a snippet of my code:
===========================================================================
public static void main(String []args) throws PyException
{
PythonInterpreter interp = new PythonInterpreter();
System.out.println("Loading Python modules...");
interp.exec("import sys; print sys.path");
interp.exec("import win32com.client");
interp.exec("x1 = win32com.client.Dispatch(\"MyApp.1\")");
}
===========================================================================
output (with error) is:
Loading Python modules...
['.', 'C:\\project\\lib\\Lib', 'C:\\python21', 'c:\\python21\\pythonwin',
'c:\
\python21\\win32', 'c:\\python21\\win32\\lib', 'c:\\python21\\dlls',
'c:\\python
21\\lib', 'c:\\python21\\lib\\plat-win', 'c:\\python21\\lib\\lib-tk',
'c:\\pytho
n21\\win32comext', 'C:\\Python21\\win32com\\client']
Exception in thread "main" Traceback (innermost last):
File "<string>", line 1, in ?
File "C:\Python21\win32com\__init__.py", line 5, in ?
ImportError: no module named win32api
===========================================================================
|