Python + COM problem. :(

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ixokai

    Python + COM problem. :(

    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...
    [color=blue][color=green][color=darkred]
    >>> import win32com.client
    >>> win32com.client .Dispatch("Word .Application")[/color][/color][/color]
    <COMObject Word.Applicatio n>

    But as soon as I shut word down...
    [color=blue][color=green][color=darkred]
    >>> win32com.client .Dispatch("Word .Application")[/color][/color][/color]
    Traceback (most recent call last):
    File "<interacti ve input>", line 1, in ?
    File "Z:\Python23\Li b\site-packages\win32c om\client\__ini t__.py", line 95,
    in Dispatch
    dispatch, userName =
    dynamic._GetGoo dDispatchAndUse rName(dispatch, userName,clsctx )
    File "Z:\Python23\Li b\site-packages\win32c om\client\dynam ic.py", line 84,
    in _GetGoodDispatc hAndUserName
    return (_GetGoodDispat ch(IDispatch, clsctx), userName)
    File "Z:\Python23\Li b\site-packages\win32c om\client\dynam ic.py", line 72,
    in _GetGoodDispatc h
    IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx,
    pythoncom.IID_I Dispatch)
    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


  • Mark Hammond

    #2
    Re: Python + COM problem. :(

    Ixokai wrote:
    [color=blue]
    > 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.[/color]

    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.

    Comment

    • Ixokai

      #3
      Re: Python + COM problem. :(

      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" <mhammond@skipp inet.com.au> wrote in message
      news:c06c5r$1qe 8$1@arachne.lab yrinth.net.au.. .[color=blue]
      > Ixokai wrote:
      >[color=green]
      > > Greetings...
      > >
      > > I'm working on automating Word, and have run into an interesting problem[/color][/color]
      on[color=blue][color=green]
      > > 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.[/color]
      >
      > 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.
      >[/color]


      Comment

      Working...