Python COM vs Visual Basic COM

Kendall Dugger kwd at
Fri Sep 3 18:31:04 CEST 2004

I have to use an ultra simple call to a couple of
WordPerfect COM functions.

This works in Visual Basic as follows:

    Dim objWP As Variant
    Dim DocSumString As Variant
    Set objWP = CreateObject("WordPerfect.PerfectScript")
    objWP.FileOpen "c:\zebra.wpd", 1
    DocSumString = objWP.DocSumGet(18)
    Me!Text1 = DocSumString

This opens a WordPerfect file and grabs the 'Descriptive
Type' field from the document summary as a string.  Pretty

Here is almost Identical Python Code:

import win32com.client
objWP =
objWP.FileOpen("c:\\zebra.wpd", 1)
DocSumString = objWP.DocSumGet(18)

When I run it it gives me the following error:

Traceback (most recent call last):
  File "C:/python_code/", line 3, in
    objWP.FileOpen("c:\\zebra.wpd", 1)
line 484, in __getattr__
    raise pythoncom.com_error, details
com_error: (-2147352567, 'Exception occurred.', (61704,
'WPWIN10', 'Internal application error.', None, 0, 0), None)

I am unable to decipher what this means and am at a loss for
what to try next.

I can write my application in Visual Basic if I have to, but
I would much rather use Python.  

Any assistance will be greatly appreciated.



More information about the Python-list mailing list