[python-win32] no array returned in output parameter

Roger Upole rwupole at msn.com
Wed Dec 17 04:54:41 CET 2008


Mark Hammond wrote:
> On 17/12/2008 12:30 AM, Roger Upole wrote:
>> Enric Jaen wrote:
>>>
>>>
>>> It's the library of the Xcalibur, a propietary program used in
>>> proteomics. to read spectra. They provide an API, and VB examples to
>>> access it.
>>>
>>> The problem is happening with those methods that return and array, as
>>> the others work fine.
>>>
>>> I am using defaultNamedNotOptArg= pythoncom.Missing
>>>
>>> Is there something else I should check?
>>>
>>>
>>
>> Try using pythoncom.Empty instead of Missing. Missing can be interpreted
>> as the end of
>> the argument list, so the app sees no arguments at all.
>
> It would be very interesting if that was the problem.  Empty makes most
> sense for "out" args, but it is impossible/pointless to have Empty
> specified after Missing - and many common objects work much better with
> Missing.  I wish I knew exactly what VB did (and I suppose some
> reverse-engineering could probably tell us), but that will need a
> round-tuit too...
>
> Mark

It make perfect sense to have a real arg after Missing when there are
optional args.  Say you have a method that takes 3 optional args, and
makepy generates something like

def somemeth(self, arg1 = pythoncom.Missing, arg2 = pythoncom.Missing, arg3 
= Pythoncom.missing):
    ...

You may want to call it with just arg3 like so:
somemeth(arg3='something')
However, you *can't*.  As soon as pythoncom sees Missing for arg1,
the rest of the arguments are silently ignored.

      Roger



More information about the python-win32 mailing list