COM: Returning IDispatch or NULL

Juan Carlos CORUÑA jcc at
Mon Sep 23 11:00:15 EDT 2002


I'm trying to develop a COM Server in python, that has a method that
returns an IDispatch object but sometimes it must return nothing. See
the following example programmed in C/SIDE (Microsoft Navision
Financials ERP):

otherCOMServer := COMServer.returnOtherCOMServer();
IF ISCLEAR(otherCOMServer) THEN MESSAGE('otherCOMServer is clear');

Definition of ISCLEAR (extracted from MS Navision help):
  The return value is TRUE if:
    -the automation variable has not been created. See CREATE.
    -the automation variable has been cleared. See CLEAR.
    -the automation variable has been assigned NULL by an automation

I thing that in this case I must assign NULL to the otherCOMServer
variable in order to keep the otherCOMServer variable CLEARED.
What must I return from "COMServer.returnOtherCOMServer()" method to
assign NULL?
I have tried:
  return None
  return wrap(None)
  return 1==0

but without success. The environment responds "data type not

I know that other COM servers developed by Microsoft Navision works
this way.

Thanks in advance.

More information about the Python-list mailing list