[python-win32] no array returned in output parameter

Mark Hammond skippy.hammond at gmail.com
Wed Dec 17 23:41:53 CET 2008


On 17/12/2008 2:54 PM, Roger Upole wrote:
> 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.

But unless I'm missing your point, that is exactly the purpose of 
pythoncom.Empty?  Further, in the example above, the call is probably 
best made with no positional args at all, using only the "named args" 
feature of IDispatch - however, pythoncom has zero support for making 
such calls :(

Cheers,

Mark



More information about the python-win32 mailing list