[python-win32] no array returned in output parameter

Enric Jaen enricjaen at yahoo.es
Thu Dec 18 14:07:42 CET 2008


in my case the call getFilters() has no input params  and 2 output params. 
Either if I use Empty or Missing the result is a null array.

I put below the description that comes with  the GetFilters() API,  in case this gives you any idea about what is going on.

Thanks,
/Enric

ps: GeFilters API:

long    GetFilters(VARIANT FAR* pvarFilterArray, long FAR* pnArraySize);

Return Value

1 if successful; otherwise, see Error Codes.

Parameters

pvarFilterArray    A valid pointer to a variable of type VARIANT. This variable must exist and be initialized to VT_EMPTY.

pnArraySize    A valid pointer to a variable of type long. This variable must exist.

Remarks

Returns the list of unique scan filters for the raw file. This function is only supported for MS device controllers. If the function succeeds, pvarFilterArray will point to an array of BSTR fields each containing a unique scan filter and pnArraySize will contain the number of scan filters in the pvarFilterArray.

Example

// example for GetFilters
VARIANT varFilters;
VariantInit(&varFilters);
long nArraySize = 0;
long nRet = XRawfileCtrl.GetFilters ( & varFilters, &nArraySize );
if( nRet != 1 )
{
    ::MessageBox( NULL, _T(“Error getting array of scan filters”), _T(“Error”), MB_OK );
    return
}




----- Mensaje original ----
De: Mark Hammond <skippy.hammond at gmail.com>
CC: python-win32 at python.org
Enviado: miércoles, 17 de diciembre, 2008 23:41:53
Asunto: Re: [python-win32] no array returned in output parameter

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

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



      


More information about the python-win32 mailing list