COM: Returning IDispatch or NULL
Juan Carlos CORUÑA
jcc at ibdosnorte.com
Tue Oct 1 17:21:07 EDT 2002
More information about the Python-list mailing list
Tue Oct 1 17:21:07 EDT 2002
- Previous message (by thread): Tkinter problem
- Next message (by thread): RELEASE: Recodec 0.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jcc at ibdosnorte.com (=?ISO-8859-1?Q?Juan_Carlos_CORU=D1A?=) wrote in message news:<a230569c.0209232353.2710adc8 at posting.google.com>... > Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<Z5Oj9.12374$6g7.37565 at news-server.bigpond.net.au>... > > Juan Carlos CORUÑA wrote: > > > Hello, > > > > > > 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 > > > server. > > > > > > 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 > > > return > > > > > > but without success. The environment responds "data type not > > > supported". > > > > None is the way to do this. What responds "data type not supported"? > > Have you registered your object for debugging and seen the output? > > There may be a traceback printed. > > > > Mark. > > After executing "return None" Navision responds "This data type is not > supported by C/SIDE". > > The debugging output is correct: > > OutMessage created <NAVISIONSPREADLib.OutMessage instance at > 0x02406260> > Object with win32trace dispatcher created > (object=<NAVISIONSPREADLib.OutMessage instance at 0x02406260>) > Returning wrapped <PyIDispatch at 0x24fde14 with obj at 0x2406468> > in _Invoke_ with 1000 1024 1 (<PyIDispatch at 0x24fde14 with obj at > 0x1caad68>,) > in _Invoke_ with 1002 1024 1 (1000,) > returning None > > The invoke with 1002 is the call to the method that returns NULL or an > object after 1000 ms of timeout. In order to discover the problem I created a simplistic method in Visual Basic and the same in python. Here is the method in VB: Public Function AMethod() as Object Set AMethod = Nothing End Function Here is the method in Python: def AMethod(self): return # I also test with return None The type library look identical for the both methods. And the result if I invoke the methods from python is "None" in both cases, but if I invoke the methods from C/SIDE (Navision) the behaviour of the VB method is as expected, but the python object returns an error message saying that this type of data is not supported by C/SIDE. Since I don't know the internals of python COM implementation, can anyone help me to discover the problem? Mark, I suspect there must be a bug in the python COM implementation, because of the different behaviour of the VB and the python method.
- Previous message (by thread): Tkinter problem
- Next message (by thread): RELEASE: Recodec 0.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list