py2exe and COM problem

Naytie naytie at yahoo.com
Thu Aug 17 10:22:44 EDT 2006


I seem to have a problem with a generated .exe file made with py2exe. I
wrote a python program that creates tables in a Word document and
adjusts the size of the tables and then inputs text into each cell
using COM. Everything works well and I do not get errors using Boa
constructor. However when I run the .exe file I get an error:

File "<COMObject <unknown>>", line 3, in SetWidth
pywintypes.com_error: (-2147352561, 'Parameter not optional.', None,
None)

which is a reference to

w.Selection.Tables(1).Columns(1).SetWidth(ColumnWidth=35)

w is an object created with win32 com

w = win32com.client.Dispatch('Word.Application')

I am assuming the 'Parameter not optional' may be saying that I cannot
change the width. This is the correct code that I took from VB. Can
anyone help? I am using Python 2.4 and MS Word 2000.




More information about the Python-list mailing list