Question
· Feb 10, 2023

Intersystems Iris - embedded python

Hello,

I'm starting testing embedded python and external libraries.

When I try to use the win32api-library I get the following error :

<THROW> *%Exception.PythonException  230 ^^0^ <class 'ModuleNotFoundError'>: No module named 'win32api' -

This is my code :

ClassMethod CreateDocument(path As %String) [ Language = python ]
{
import win32api

...
}
 

The librarie is visible in C:\InterSystems\IRIS\mgr\python\win32.

Am I doing something wrong ?

Regards,

Kurt Hofman,

ASCI nv.

Product version: IRIS 2022.3
$ZV: IRIS for Windows (x86-64) 2023.1 (Build 185U) Tue Jan 31 2023 22:19:19 EST
Discussion (7)2
Log in or sign up to continue

Looks like win32api in not installed with IRIS.

Try to install win32api module by running below command :

C:\InterSystems\IRIS\bin>irispip install --target C:\InterSystems\IRIS\mgr\python win32api

Replace C:\InterSystems by your IRIS installation folder

For more details please check below link
https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

Hello @Kurt Hofman ,

I experienced a similar problem the last week while testing a library.

To solve it, I created the PYTHONPATH system environment variable with C:\InterSystems\IRISHealth\lib\python\Lib\site-packages\win32;C:\InterSystems\IRISHealth\lib\python\Lib\site-packages\win32\lib.
IRIS need to be restarted to consider any change in an environment variable.

Check If pythoncom39.dll and pywintypes39.dll exist in the directory C:\InterSystems\IRISHealth\lib\python\Lib\site-packages\win32. If they don't exist, copy them. I don't remember the initial directory of these dll files (maybe C:\InterSystems\IRISHealth\mgr\python\pywin32_system32).

I'm a beginner in Python, so maybe a more simple and clean solution exists...

Hope this help.