[python-win32] Dispatches With Events on COM Object
Neil Benn
benn at cenix-bioscience.com
Fri Aug 4 10:46:33 CEST 2006
Mark Hammond wrote:
>> print dir(mod)
>> ob = mod.Application
>>
>
> Try adding parens after that line - currently 'ob' is the class, where you
> want an instance of the class.
>
> ob = mod.Application()
>
>
<snip>
Ah good point, I put back in the brackets (doh!) and I am now back to
the previous place:
mod = gencache.EnsureModule('{A4818FD5-6479-11D4-8452-00104B92DD56}', 0,
1, 0)
print dir(mod)
ob = mod.Application()
print dir(ob)
objCybio = win32com.client.DispatchWithEvents(ob, CybioEvents)
>>> ['Application', 'CLSID', 'CLSIDToClassMap', 'CLSIDToPackageMap',
'CoClassBaseClass', 'Dispatch', 'DispatchBaseClass', 'IApplication',
'IApplicationEvents', 'IApplicationEvents_vtables_',
'IApplicationEvents_vtables_dispatch_', 'IDocumentEvents',
'IDocumentEvents_vtables_', 'IDocumentEvents_vtables_dispatch_', 'IID',
'LCID', 'LibraryFlags', 'MajorVersion', 'MinorVersion', 'NamesToIIDMap',
'RecordMap', 'VTablesToClassMap', 'VTablesToPackageMap', '__builtins__',
'__doc__', '__file__', '__name__', '_in_gencache_',
'defaultNamedNotOptArg', 'defaultNamedOptArg', 'defaultUnnamedArg',
'makepy_version', 'python_version', 'pythoncom', 'win32com']
['CLSID', '__doc__', '__getattr__', '__init__', '__module__',
'__repr__', '__setattr__', '_dispobj_', 'coclass_interfaces',
'coclass_sources', 'default_interface', 'default_source']
Traceback (most recent call last):
File "C:\Program
Files\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Documents and Settings\benn\Desktop\cybio test.py", line 16, in ?
objCybio = win32com.client.DispatchWithEvents(ob, CybioEvents)
File "C:\Program
Files\Python24\Lib\site-packages\win32com\client\__init__.py", line 254,
in DispatchWithEvents
raise TypeError, "This COM object can not automate the makepy
process - please run makepy manually for this object"
TypeError: This COM object can not automate the makepy process - please
run makepy manually for this object
I've got it working OK with C# running through SharpDevelop - I'd
prefer not to use C# though as my company is a python programming
company and using C# would cause support issues.
Although I'm not sure if there are any other solutions in the python
environment - is there a debug switch on the native code I can turn on
to if the problems are coming from there?
Cheers,
Neil
--
Neil Benn MSc
Head of Automation
Cenix BioScience GmbH
Tatzberg 47
01307 Dresden
Germany
http://wwww.cenix-bioscience.com
More information about the Python-win32
mailing list