Help with COM_error

Mark Hammond skippy.hammond at
Tue Feb 7 05:56:45 CET 2012

Unfortunately this just means that Word threw an error and it's not 
giving many details about what that might be.  Are you sure out_TOC is 
valid on the other computer?  eg, 
indicates Office fails in that way when the path isn't valid...


On 4/02/2012 12:10 AM, John Lay wrote:
> 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