[python-win32] ByRef params not working with PythonCOM

Mark Hammond mhammond at skippinet.com.au
Wed Oct 8 04:04:53 CEST 2008


Try passing pythoncom.Empty for the out param - that will provide a VT_EMPTY
param to the object, which it will hopefully accept and fill with the
result.

 

Mark

 

From: python-win32-bounces+skippy.hammond=gmail.com at python.org
[mailto:python-win32-bounces+skippy.hammond=gmail.com at python.org] On Behalf
Of Greg Antal
Sent: Tuesday, 7 October 2008 4:10 AM
To: python-win32 at python.org
Subject: Re: [python-win32] ByRef params not working with PythonCOM

 

Greetings all.

I posted this a week ago and had no response, so I'll try again.  Any
information would be helpful, even if it's just "that all looks right, no
idea why it doesn't work."  I'll gladly provide more info if needed, or try
a different statement of the problem if it isn't clear.

Thanks,
Greg Antal



Gregory W. Antal
Senior Technical Advisor
ATA Engineering, Inc.
11995 El Camino Real, Suite 200      
San Diego, CA  92130
www.ata-e.com
 
greg.antal at ata-e.com
858-480-2072  (Phone)
858-792-8932  (Fax)



Greg Antal wrote: 

Gentlemen:

I need to work with a TLB for a finite element pre/post processor called
Femap.  Its API was built for Visual Basic, and it uses output arguments in
many of its functions/methods.  Methods with only input arguments and return
values work great, but I can't get anywhere with those that have output
arguments.

Here's the documentation for a method 'Count' of the class 'feSelector':
Count ( entityType, nSelected )
Description:
  This method returns the number of entities of a given type that are
currently selected
Input:
    INT4 entityType
        The entity type to query (node, element, etc)
Output:
    INT4 nSelected
        The number of "entityType" entities that are currently selected.
Return Code:  None

Here's the code makepy.py generated for this method:
    def count(self, entityTYPE=defaultNamedNotOptArg,
nSelected=pythoncom.Missing):
        return self._ApplyTypes_(20002, 1, (3, 0), ((3, 1), (16387, 2)),
'count', None,entityTYPE
            , nSelected)

>From all the documentation I've been able to find (including the archives
of this mailing list back to September 2005), my Python call should look
like this:
nSel = zSelect.count(eFemTyps.FT_NODE)

When I try that, I get:
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "<COMObject feSelector>", line 2, in count
com_error: (-2147352561, 'Parameter not optional.', None, None)

I've tried supplying the extra parameter, but that results in a 'type
mismatch' error, which probably doesn't surprise anyone.  Can someone help?

Thanks,
Greg Antal 

 



  _____  



 
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20081008/5f02c334/attachment-0001.htm>


More information about the python-win32 mailing list