[python-win32] Makepy static and dynamic Dispatch COM headache

Andrea Gavana andrea.gavana at gmail.com
Sat May 22 15:10:35 CEST 2010

Hi All,

I have been spending the most part of the day to try to use makepy or
Dispatch on a proprietary dll library (PISDK for those who know it). I
did the following 2 things (not at the same time):

1) makepy.py -o PISDK.py C:/Program Files/PIPC/PISDK/pisdk.dll

And I got a nice and big PISDK.py file on my computer, with all the
methods/attributes I could ever need. However, when I try to use it, I
get this:

import PISDK
servers = PISDK.Servers()

Traceback (most recent call last):
  File "D:\MyProjects\PI\PI.py", line 9, in <module>
    servers = PISDK.Servers()
  File "C:\Python26\lib\site-packages\win32com\client\__init__.py",
line 420, in __init__
    oobj = pythoncom.new(self.CLSID)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

Not good.

2) If I try to be smart and use Dispatch, I get the following:

PISDK = Dispatch("PISDK.PISDK.1")

server = PISDK.Servers.DefaultServer

point = server.PIPoints("KA:Well:WP9810_PI002.PV")
data = point.Data.Snapshot

print data.Value # => 106.406433105
print data.TimeStamp.LocalDate # => 05/22/10 18:05:04

start = "01/01/2010"
end = "10/01/2010"

# Here we crash
print point.Data.InterpolatedValues2(start, end, 10)

Traceback (most recent call last):
  File "D:\MyProjects\PI\PI.py", line 20, in <module>
    point.Data.InterpolatedValues2(start, end, 10)
  File "<COMObject <unknown>>", line 4, in InterpolatedValues2
  File "C:\Python26\lib\site-packages\win32com\client\dynamic.py",
line 272, in _ApplyTypes_
    result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags,
retType, argTypes) + args)
TypeError: The Python instance can not be converted to a COM object

Not good.

Could someone please offer some suggestions about these issues? I am
really stuck, and no expert at all with COM...

Thank you in advance.


"Imagination Is The Only Weapon In The War Against Reality."

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html <==

More information about the python-win32 mailing list