win32 module

needed to install win32 module.

Was led to ‘pywin32’
Idle now successfully runs speech synth program i was trying to set up.
TD doesnt see it though:

I assume I need to point 64 bit module path or windows environment variable? But where ? Windows search doesn’t find anything.

First thing to check is that you have the parameter in TouchDesigner set correctly.

Go to Edit/Preferences and take a look at the ‘python 64 bit module path’ parameter. Mine is set to “C:/Users/[my user name]/AppData/Local/Programs/Python/Python36-32/Lib/site-packages”

But this could be different depending on where you installed your version of Python. After the parameter is set, save and restart TouchDesigner

Also a good thing to check is that your python path is in your path environment variable. Easiest way is to push the windows button and start typing “environment variables” and usually it comes up. Then you can add your python path to your ‘path’ environment variable. Typically the newer python installers will ask you if you want to do this automatically during setup and if your pip command is working then chances are your path variable is correct as well. You can always check by opening up cmd and typing ‘python --version’

thks but still not happening for me unfortunately.

I checked:

C:\Users\c.o’d>python --version
Python 3.5.1

I can run the program from idle or feed it line by line thru command line, so i know its working.

my 64 bit module path is :


I can see the package in the folder and it finds it outside of touch.

I run same script in touch and get:

[code]TouchDesigner 64-Bit 099 Build 2018.41570 compile on Tue Nov 13 15:13:15 2018
Python 3.5.1+ (default, Apr 21 2016, 11:06:11) [MSC v.1900 64 bit (AMD64)]

python >>>
Traceback (most recent call last):
File “</project1/text1:op(’/project1/text1’).run()>”, line 1
td.Error: File “C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\”, line 44, in init
eng = _activeEngines[driverName]
File “C:\Program Files\Derivative\TouchDesigner099\bin\lib\”, line 131, in getitem
o = self.datakey
KeyError: None

During handling of the above exception, another exception occurred:

File “/project1/text1”, line 2
File “C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\”, line 46, in init
eng = Engine(driverName, debug)
File “C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\pyttsx3\”, line 52, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File “C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\pyttsx3\”, line 75, in init
self.module = importlib.import_module(name)
File "C:\Program Files\Derivative\TouchDesigner099\bin\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 958, in _find_and_load_unlocked
File “”, line 673, in _load_unlocked
File “”, line 662, in exec_module
File “”, line 222, in call_with_frames_removed
File “C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\pyttsx3\drivers\”, line 3
import win32com.client
r = previousimport(*args, **kw)
r = previousimport(*args, **kw)
File "C:/Users/c.o’d/AppData/Local/Programs/Python/Python35/Lib/site-packages\win32com_init
.py", line 5
import win32api, sys, os
r = previousimport(*args, **kw)
ImportError: No module named ‘win32api’
Results of run operation resulted in exception. <type:textDAT path:/project1/text1> <class ‘td.textDAT’>
python >>> [/code]

The way I’m understanding what is going on:I cant install win32 separately because its old and there doesnt seem to be any package for 3.5.1 Python. But somehow pyttsx3 finds it outside of touch? is it embedded in the pyttsx3 ?
I dont get it.

script that works in IDLE:

[code]import pyttsx3
engine = pyttsx3.init()

engine.say(“2015 between April and July, and a hardcover collection went on sale in November. Archie Comics proposed the idea to Dark Horse, which holds the license to comics featuring 20th Century Fox’s Predator. The series received positive reviews from critics, who enjoyed the strange matchup and dark humor. The April issue was the top seller for both publishers, and garnered a”)



thsnks for your help.

hey cod65,

In TouchDesigner try this:

[code]import sys

for each in sys.path:

Check to make sure that your external library path is in that list:


If it’s not in there you can append your path to the list. Quit and restart touch, then try again.

ah, dude. thks . I think I see what might be a problem … when i recently bought this computer I may have made an error in haste and made my user name “c.o’d” …

hmmm probably not a good idea to use punctuation inuser name/paths especially on windows … Oh this might be ugly!

I’m curious if you got this to work. I’ve realized that there is something particular about this module that doesn’t seem to import correctly into TouchDesigner.

This problem came up in the past and the solution was to add a few extra system path variables like so:

sys.path.append("C:/Python35/Lib/site-packages/win32") sys.path.append("C:/Python35/Lib/site-packages/win32/lib") sys.path.append("C:/Python35/Lib/site-packages/Pythonwin")

I’m trying to import the ‘win32print’ and ‘win32api’ modules but this doesn’t seem to be working for me today. Has anyone had any success with this lately?

Matt I thought I got it to work one time, then I had other issues and couldn’t get it to work again in a fresh environment. I gave up, for the time being. Possibly path issues.

Yeah I gave up as well.

My current workaround is just to call external scripts with os.sys() if I really need to use this module.

If anyone figures this out feel free to post your solution here!

1 Like

I’m in the same boat. I find instead I have to run the external script, pass over it’s values and try to match it back up with the monitors DAT. This should be easier.

the thread that keeps on keepin on !

I had the same problem. I went to hell and back with it.
Since TD uses 3.7.2 python module install pywin32==225 version, than install the post install file with

py “your_python37path\Scripts\” -install

it worked for me :slight_smile: