Mark Hammond wrote:
> I'd suggest passing 'useDispatcher=1' to com_wrap, so that debug output is
> generated as your object is called (you can see it via the win32traceutil.py
> tool).
Thank you for the reply.

I'd made it in such way:
<code lang='python'>
class LocateCommandEvents(object):
   _com_interfaces_ = [IID_ILocateCommandEvents]
   _typelib_guid_ = '{CF9F97BF-39F2-4B8E-835C-8BE9E99DAF5B}'
   _typelib_version_ = 8, 0
   _typelib_lcid_ = 0

   _public_methods_ = []
   _dispid_to_func_ = {
     0x60020000: 'Accept', 0x60020001: 'LocateFailed', 0x60020002:
'LocateFilter', 0x60020003: 'LocateReset', 0x60020004: 'Cleanup',
0x60020005: 'Start', 0x60020006: 'Dynamics'}
</code>
after it and after editing in win32com.server.policy
(http://sourceforge.net/tracker/?func=detail&aid=1892592&group_id=78018&atid=551956)
 

the call of
StartLocate has worked successfully.

Now errors occur in calls to LocateCommandEvents.LocateFilter function
from MicroStation:
<code>
pythoncom error: Failed to call the universal dispatcher

Traceback (most recent call last):
   File "C:\Lang\Python\25\lib\site-packages\win32com\universal.py",
line 193, in
  dispatch
     WriteFromOutTuple(retVal, meth._gw_out_args, argPtr)
<type 'exceptions.TypeError'>: The VARIANT type is unknown (0x24).
pythoncom error: Unexpected gateway error

Traceback (most recent call last):
   File "C:\Lang\Python\25\lib\site-packages\win32com\universal.py",
line 193, in
  dispatch
     WriteFromOutTuple(retVal, meth._gw_out_args, argPtr)
<type 'exceptions.TypeError'>: The VARIANT type is unknown (0x24).
</code>

Perhaps the reason of it is that ILocateCommandEvents turn out not fully
compatible with IDispatch interfaces:
<code lang='IDL'>
     [
       odl,
       uuid(67CBDE4A-F073-11D4-A8E6-00508B4D8FED),
       helpcontext(0x0000021a),
       dual,
       nonextensible,
       oleautomation
     ]
     interface ILocateCommandEvents : IDispatch {
         [id(0x60020000), helpcontext(0x0000001d)]
         HRESULT Accept(
                         [in] _Element* Element,
                         [in, out] Point3d* Point,
                         [in] _View* View);
         [id(0x60020001), helpcontext(0x00000025)]
         HRESULT LocateFailed();
         [id(0x60020002), helpcontext(0x00000026)]
         HRESULT LocateFilter(
                         [in] _Element* Element,
                         [in, out] Point3d* Point,
                         [in, out] VARIANT_BOOL* Accepted);
         [id(0x60020003), helpcontext(0x00000027)]
         HRESULT LocateReset();
         [id(0x60020004), helpcontext(0x00000020)]
         HRESULT Cleanup();
         [id(0x60020005), helpcontext(0x0000002e)]
         HRESULT Start();
         [id(0x60020006), helpcontext(0x00000022)]
         HRESULT Dynamics(
                         [in, out] Point3d* Point,
                         [in] _View* View,
                         [in] MsdDrawingMode DrawMode);
     };
</code>
Point3d - struct, MsdDrawingMode - enum, declared in MicroStation Typelib.

Can you give me an advise in the case?

> Its hard to tell though, as the MicroStation object is throwing a
> type error without providing any other information about what it is upset
> about.  You might want to check that MicroStation supports IDispatch based
> event interfaces, otherwise you will need yet more magic to make things
> work...
> 
> Cheers,
> 
> Mark


_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to