win32com - .ocx won't Dispatch...

Ray Schumacher rays at blue-cove.com
Thu Jan 29 16:44:09 EST 2004


At 12:12 PM 1/29/2004, Markus Wankus wrote:
>Open the gen_py'd file 8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x3x5.py, and do some searching.  You should be able to find an obvious main class related to what you are doing (I'm not sure what the .tlb is), and it will say in the comment or docstring that it is a "<foo>.<bar>", or whatever. 

Thanks Markus,

The lines are from CoClassBaseClass:
...
# This CoClass is known by the name 'EDREUTLX.EDREUtlXCtrl.1'
class EDREUtlX(CoClassBaseClass): # A CoClass
...
That would be a helpful bit for the docs! 

So, the util class Dispatches, but all calls (properties and functions) give 'Catastrophic failure'
Is this really some sort of types problem with this OCX?
"pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None)"

Thanks for the help,
Ray

Test run below, kitchen sink included:

C:\projects\CV-Mini>python
Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from win32com.client import *
>>> util = gencache._GetModule('8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x3x5')
>>> gencache.GetGeneratedFileName('8AA34F82-95C9-11D3-8EB6-00C0DF2247CA',0,3,5)
'AA34F82-95C9-11D3-8EB6-00C0DF2247Cx0x3x5'
>>> gencache.MakeModuleForTypelib('8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x3x5',0
,3,5)
>>> gencache.GetModuleForCLSID('8AA34F82-95C9-11D3-8EB6-00C0DF2247CA')
>>> gencache.GetClassForCLSID('8AA34F82-95C9-11D3-8EB6-00C0DF2247CA')
>>> gencache.GetModuleForProgID('EDREUTLX.EDREUtlXCtrl.1')
<module 'win32com.gen_py.8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x3x5' from 'C:\Py
thon23\lib\site-packages\win32com\gen_py\8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x
3x5.pyc'>
>>> gencache.EnsureModule('{8AA34F82-95C9-11D3-8EB6-00C0DF2247CA}',0,3,5)
<module 'win32com.gen_py.8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x3x5' from 'C:\Py
thon23\lib\site-packages\win32com\gen_py\8AA34F82-95C9-11D3-8EB6-00C0DF2247CAx0x
3x5.pyc'>
>>> gencache.EnsureModule('EDREUTLX.EDREUtlXCtrl.1',0,3,5)
>>> util = Dispatch("EDREUTLX.EDREUtlXCtrl.1")
>>> util
<win32com.gen_py.EDRE Utility Control._DEDREUtlX instance at 0x11224368>
>>> gencache.EnsureDispatch(util)
<win32com.gen_py.EDRE Utility Control._DEDREUtlX instance at 0x11224728>
>>>
>>> util = Dispatch("EDREUTLX.EDREUtlXCtrl.1")
>>> util
<win32com.gen_py.EDRE Utility Control._DEDREUtlX instance at 0x11224288>
>>> # pop-up, no args
... util.AboutBox()
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
  File "C:\Python23\lib\site-packages\win32com\gen_py\8AA34F82-95C9-11D3-8EB6-00
C0DF2247CAx0x3x5.py", line 34, in AboutBox
    return self._oleobj_.InvokeTypes(-552, LCID, 1, (24, 0), (),)
pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None)
>>> # a property
... util.Version
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
  File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 451, in
 __getattr__
    return self._ApplyTypes_(*args)
  File "C:\Python23\lib\site-packages\win32com\client\__init__.py", line 445, in
 _ApplyTypes_
    return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 0, wFlags
, retType, argTypes) + args)), user, resultCLSID)
pywintypes.com_error: (-2147418113, 'Catastrophic failure', None, None)
>>>






More information about the Python-list mailing list