Error importing win32api module

Hi all,

I’ve use pip to install pypiwin32 into my 64 bit python 3.3.5 install. This provides the ‘win32api’ module that I need to call to get info about monitors connected to the system.

If I run ‘python’ from the cmd prompt and do ‘import win32api’ it works and I can make my calls as expected.

python
Python 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import win32api

However, in TD (61700), I’m getting a “ImportError: No module named win32api”.

python >>> import win32api
Traceback (most recent call last):
File “”, line 1, in
File “C:/Program Files/Derivative/TouchDesigner088/bin/TouchInit.py”, line 205, in tdcustomimport
r = previousimport(*args, **kw)
ImportError: No module named ‘win32api’

I’ve added ‘C:/Python33/Lib/site-packages’ to the Edit->Preferences->Python 64-bit module path. I can import other modules that I’ve installed without issue.

One thing that stands-out to me is that win32api is a file inside a ‘win32’ directory in the site-packages. Thus, the dirname does not match the module name. But, again, the commandline python interpreter doesn’t have any issue with this - it’s only when I try to import in Touch. This may be a red herring, though…

Other modules work, but win32api does not :frowning: Is there some trick I’m missing here?

Thanks!

try adding the full path to your installed package under Edit-pref-python64 modules.

for instance, when I wanted to import the selenium module I had installed, I had to add its full path like this in TD:

C:/Python33/Lib/site-packages/selenium-2.45.0-py3.3.egg

how do you separate multiple paths, assuming this is possible ? this .egg thing is freaking me out. i dont get it.

bit late here and beside the point but: are there things missing from the Monitors DAT


or the Monitors Class?
https://docs.derivative.ca/Monitors_Class

Thanks. Unfortunately, in v088 at the time I asked this, I do not think this was available and that was the only version available at the time when I needed to solve this problem. I will keep Monitors DAT in-mind for future use should the issue ever arise again.

You can get some additional information using the win32API and I find it very useful actually.

With this additional information, you can fingerprint each attached monitor and remember it next time it’s connected.

I found a way to do this instead of configuring each computer’s output channels individually.

I still need to run this function outside of touchdesigner. If this information was exposed in the monitors DAT. or the library worked in touch, that would be amazing.