Data Type Problem in Python / COM

Olav nekiv at
Mon Nov 7 09:40:09 CET 2005

I'm trying to use Python / COM to do some drawing automation.   Here
is a simple code example:
This code uses a object made by the Opendwg-org.  Autocad has a similar
object with the same methods - and the same result.


import win32com.client
odaApp = odaHost.Application

point = (0,0,0) #x,y,z

filename    = r'c:\temp\test.dwg'
odaDoc      = odaApp.Documents.Add(filename)



Traceback (most recent call last):
line 310, in RunScript
    exec codeObject in __main__.__dict__
  File "F:\dom-users\Autoproject\", line 13, in ?
line 9516, in AddPoint
    ret = self._oleobj_.InvokeTypes(1562, LCID, 1, (9, 0), ((12,
com_error: (-2147352567, 'Exception occurred.', (0, 'DWGdirectX', 'The
parameter is incorrect.\r\n', None, 0, -2147024809), None)


I have tried both early and late binding but with the same result.

I have seen the same code in VB, and the code looks like this:
This works.


Sub Example_AddPoint()
     ' This example creates a point in model space.
     Dim pointObj As AcadPoint
     Dim location(0 To 2) As Double
     ' Define the location of the point
     location(0) = 5#: location(1) = 5#: location(2) = 0#
     ' Create the point
     Set pointObj = ThisDrawing.ModelSpace.AddPoint(location)

It seems to me that this error is related to the data-type
Any help would be much appreciated


More information about the Python-list mailing list