Ich versuche, eine COM Methode aufzurufen. Python gibt mir aber ein "pywintypes.com_error: (-2147319779, 'Bibliothek nicht registriert.', None, None)" zurück
Ich habe
- eine COM Klasse registriert (SysWOW64/regsrv32.exe meine.dll)
- makepy ausgeführt
- in Python:
#======================================
Code: Alles auswählen
import win32com.client
from win32com.client import gencache
def main():
progID = "Meine.Prog.ID"
progName = "Der COM Name"
GUID = '{12345678-1234-1234-1234-123456789012}'
myModule = gencache.EnsureModule(GUID, 0, 2, 3)
myObject = myModule.TheCOMObject()
#datExp.__init__()
print("Module: ", dir(myModule), "\n==============================")
print("Object: ", dir(myObject), "\n==============================")
print("Function: ", getattr(myObject, "MyFunction"))
print("Arguments: ", myObject.MyFunction.__defaults__)
print("IsInstance: ", isinstance(myObject, myModule.TheComObject))
print("IsCallable(object): ", callable(myObject))
print("IsCallable(function): ", callable(myObject.MyFunction))
myObject.MyFunction()
if __name__ == '__main__':
main()
Die Ausgabe:
[codebox=text file=Unbenannt.txt]Function: <bound method TheCOMObject.MyFunction of <win32com.gen_py.My COM Class Name Type Library.TheComObject instance at 0x2689136>>
Arguments: None
IsInstance: True
IsCallable(object): False
IsCallable(function): True
Traceback (most recent call last):
File "MyFile.py", line 180, in MyFunction
return self._oleobj_.InvokeTypes(14, LCID, 1, (24, 0), (),)
pywintypes.com_error: (-2147319779, 'Bibliothek nicht registriert.', None, None)[/code]
Das Modul ist geladen, das Objekt ist instanziert, das Objekt hat die Funktion MyFunction, MyFunction is "callable" aber ich kann die Funktion nicht ausführen.
Die Fehlermeldung ist "pywintypes.com_error: (-2147319779, 'Bibliothek nicht registriert.', None, None)".
Warum kann ich die Funktion nicht ausführen, bzw. was bedeutet hier "Library not registered." ?
Vielen Dank für Eure Mühe, LG, WOL