PDA

View Full Version : Speech


nige777
04-07-2011, 02:22 PM
Thought I'd give speech recognition a whirl, so after installing pywin32 I navigate to the makepy script in the Viz 4 site-packages but all I get is an error message thus:
C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\__init__.py:89: ImportWarning: Not importing directory 'C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\gen_py': missing __init__.py
import win32com.gen_py
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\makepy.py", line 70, in <module>
from win32com.client import genpy, selecttlb, gencache
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\__init__.py", line 11, in <module>
import gencache
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\gencache.py", line 662, in <module>
__init__()
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\gencache.py", line 58, in __init__
Rebuild()
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\gencache.py", line 649, in Rebuild
_SaveDicts()
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\gencache.py", line 65, in _SaveDicts
f = open(os.path.join(GetGeneratePath(), "dicts.dat"), "wb")
File "C:\Program Files\WorldViz\Vizard4\bin\lib\site-packages\win32com\client\gencache.py", line 141, in GetGeneratePath
f = open(fname,"w")
IOError: [Errno 13] Permission denied: 'C:\\Program Files\\WorldViz\\Vizard4\\bin\\lib\\site-packages\\win32com\\gen_py\\__init__.py' :confused:

Would be nice to be able to start moving my work over to 4, but am a bit stuck because I also use other automation objects via makepy, so its quite a biggy for me.

Any ideas whats going on from that error message?

farshizzo
04-07-2011, 02:31 PM
You probably don't have write permissions for that folder. Try running the makepy script using admin privileges.

nige777
04-08-2011, 04:17 AM
Ok, well managed to get makepy to run through the Viz 4 interactive prompt (is this a valid method of doing this?) using this code:-
import win32com.client.makepy
win32com.client.makepy.ShowInfo("")
- select the MS Speech object from the list and it spits out this
Microsoft Speech Object Library
{C866CA3A-32F7-11D2-9602-00C04F8EE628}, lcid=0, major=5, minor=4
>>> # Use these commands in Python code to auto generate .py support
>>> from win32com.client import gencache
>>> gencache.EnsureModule('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 4)

However when I then run the speech.py script I get this error message-
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "C:\Users\APD\Documents\Nige_PHD\Vizard_Python Development\speek.py", line 56, in <module>
class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")):
TypeError: Error when calling the metaclass bases
cannot create 'NoneType' instances

Any ideas?? Am I doing something wrong :confused: I got it to work in Viz3 with very little problem.

nige777
04-08-2011, 04:51 AM
Interestingly I have just managed to manipulate the IFCsvr activeX object with no problems - however I am using this within my code-
from win32com.client import gencache
gencache.EnsureModule('{B2173F4D-1371-4649-8554-310D6DC1734F}', 0, 1, 4)

I've noticed this method is different to what's being used in the Speek script (as it is presented in the knowledgebase article), what am I doing wrong can anyone tell? :confused:

gribbers
08-25-2012, 10:46 AM
nige777,

Did you ever get to the bottom of this? I only ask because I'm having the same problem even though I'm logged in as 'Administrator'.

Thanks.

gribbers
09-04-2012, 01:42 AM
Ignore my previous post. Simple permissions problem. How embarrassing!