Python + COM problem. :(

Ixokai usenet at ixokai.net
Sun Feb 8 01:55:51 EST 2004


Greetings...

I'm working on automating Word, and have run into an interesting problem on
one workstation. If Word is not already running, then I can't run the
'Dispatch' to get the word application. On my PC at work, that's not the
case.

For example.. With word running...

>>> import win32com.client
>>> win32com.client.Dispatch("Word.Application")
<COMObject Word.Application>

But as soon as I shut word down...

>>> win32com.client.Dispatch("Word.Application")
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "Z:\Python23\Lib\site-packages\win32com\client\__init__.py", line 95,
in Dispatch
    dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "Z:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 84,
in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "Z:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 72,
in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147024770, 'The specified module could not be found.', None,
None)

Now, at work, when I called Dispatch, it'd just launch a copy of word
(hidden). So, I'm not sure what i'm doing wrong :)

Thanks for the help!

--Stephen





More information about the Python-list mailing list