By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,923 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,923 IT Pros & Developers. It's quick & easy.

Python + COM problem. :(

P: n/a
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,userN ame,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
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ixokai wrote:
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.


It is a problem specific to that machine then! Check that there aren't
any "phantom" word processes still running - use the Task Manager.

Otherwise, use the Office CD to 'repair' the installation.

Mark.

Jul 18 '05 #2

P: n/a
Well, yes, I know its specific to that machine.. i said that :) I just
thought it might have something to do with something wrong w/ my python
installation, since i've tried a repair-- reboots-- and reinstallations of
Office, all to no avail.

--Stephen

"Mark Hammond" <mh******@skippinet.com.au> wrote in message
news:c0***********@arachne.labyrinth.net.au...
Ixokai wrote:
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.


It is a problem specific to that machine then! Check that there aren't
any "phantom" word processes still running - use the Task Manager.

Otherwise, use the Office CD to 'repair' the installation.

Mark.

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.