Help with COM_error

John Lay johnphilliplay at gmail.com
Fri Feb 3 08:10:11 EST 2012


I am not a programmer, but this past week I have had a crash course in
python scripting am have been rather impressed with myself for having
written a fairly complicated script that among many other processes
reads a database table via SearchCursor, populates a word template via
Bookmarks, then saves the document out as a PDF.

The only problem is that it only works on my computer. When I move the
script to another computer with the same setup, I continue to receive
a Com_error.

The script fails at my SaveAs(out_TOC, FileFormat=wdFormatPDF)
statement. I have tried both win32com.client and comtypes.client and
receive a similar error for both.

win32.client:
com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft Word',
u'Command failed', u'C:\\Program Files\\Microsoft Office\\Office12\
\1033\\WDMAIN11.CHM', 36966, ), None)

comtypes.client:
COMError: (-2146824090, None, (u'Command failed', u'Microsoft Word',
u'C:\\Program Files\\Microsoft Office\\Office12\\1033\\WDMAIN11.CHM',
36966, None))

It has been suggested that I try python-docx, but I have not been able
to get the module to work for me and I have been unable to find any
documentation on it.

Can anyone help with the com errors? What do they mean? How do I
resolve them?

Any help would be appreciated.

John



More information about the Python-list mailing list