[python-win32] what means "library not registered"?

Michael Bode m.g.bode at web.de
Tue Dec 7 21:08:24 CET 2010

I'm trying to use a 3rd party COM dll for which I have only instructions
how to use it in VB. The instructions say I have to create a
cFM2Listener object, obtain an IFM2Listener interface from it, implement
my own version of a cFM2DeviceEvents object and assign that to the
DeviceEvents property of the cFM2Listener object.

I called makepy on the dll (FieldMax2DLLServer.dll) and got a
3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050x0x2x0.py file.
Then I try to implement the cFM2DeviceEvents object which has to
implement the IFM2DeviceEvents interface.

import win32com.client
import win32com.server.util
from win32com import universal

class Notifier(object):
    _public_methods_ = [ 'DisplayErrorToClient',  'NotifyData',
    _public_attrs_ = [ 'CallbackEvent',  'CallbackMessage',  'DeviceIndex',
                            'SerialNumber',  'ZeroDeviceTimeoutCounter']
    _com_interfaces_ = [ '_IFM2DeviceEvents' ]
    _typelib_guid_ = '{3B64E1EF-5DBC-4CCA-9C2A-F2D10C510050}'
    _typelib_version = 2,  0

    def __init__(self):
        self._CallbackEvent = ""
        self._CallbackMessage = ""
        self._DeviceIndex = 0
        self._SerialNumber = ""
        self._ZeroDeviceTimeoutCounter = 0

    def DisplayErrorToClient(self): print "DisplayErrorToClient"

    def NotifyData(self,  CallbackData): print "NotifyData"

    def NotifyDeviceStatus(self,  CallbackData,  DevicesList): print

    def DisplayZeroDeviceProgressToClient(self): print

    def get_CallbackEvent(self): return self._CallbackEvent
    def set_CallbackEvent(self, value): self._CallbackEvent = value
    CallbackEvent = property(get_CallbackEvent, set_CallbackEvent, doc =
"CallbackEvent property")

    def get_DeviceIndex(self): return self._DeviceIndex
    def set_DeviceIndex(self, value): self._DeviceIndex = value
    DeviceIndex = property(get_DeviceIndex, set_DeviceIndex, doc =
"DeviceIndex property")

    def get_SerialNumber(self): return self._SerialNumber
    def set_SerialNumber(self, value): self._SerialNumber = value
    SerialNumber = property(get_SerialNumber, set_SerialNumber, doc =
"SerialNumber property")

    def set_ZeroDeviceTimeoutCounter(self, value):
self._ZeroDeviceTimeoutCounter = value
    ZeroDeviceTimeoutCounter = property(fset =
set_ZeroDeviceTimeoutCounter, doc = "ZeroDeviceTimeoutCounter property")

0, 2, 0)
print "gencache"
fml = win32com.client.Dispatch("FieldMax2DLLServer.cFM2Listener")
print fml
0, 2, 0, ['_IFM2DeviceEvents'])
print "RegisterInterfaces"
NM = Notifier()
print NM
notifyMe = win32com.server.util.wrap(NM, useDispatcher=1)

And here I get the following error:

Traceback (most recent call last):
  File "C:\myprogs\python\comtest\comtest.py", line 63, in <module>
    notifyMe = win32com.server.util.wrap(NM, useDispatcher=1)
  File "C:\Python27\lib\site-packages\win32com\server\util.py", line 25,
in wrap
    ob = useDispatcher(usePolicy, ob)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py",
line 203, in __init__
    DispatcherTrace.__init__(self, policyClass, object)
  File "C:\Python27\lib\site-packages\win32com\server\dispatcher.py",
line 24, in __init__
    self.policy = policyClass(object)
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line
181, in __init__
  File "C:\Python27\lib\site-packages\win32com\server\policy.py", line
466, in _wrap_
    tlb_major, tlb_minor, interfaces)
  File "C:\Python27\lib\site-packages\win32com\universal.py", line 21,
in RegisterInterfaces
    tlb = pythoncom.LoadRegTypeLib(typelibGUID, major, minor, lcid)
com_error: (-2147319779, 'Bibliothek nicht registriert.', None, None)

The message in the last line translates to 'library not registered'.

I have a sample VB program which works fine, so I don't think this means
there is something wrong with the FieldMax2DLLServer.dll. But what am I
doing wrong here?

PGP fingerprint: A391 4109 F8D0 F67B C504  1EF6 0158 E3BB 3687 53CF

More information about the python-win32 mailing list