[python-win32] By-reference COM method arguments not being treated as outputs

Greg Antal greg.antal at ata-e.com
Mon Jul 27 23:20:04 CEST 2009


Mike:

When I ran into this, it was because the type library on which I ran 
makepy was not quite correctly defined.  You could check the archives of 
this mailing list starting at

http://www.mail-archive.com/python-win32@python.org/msg05578.html

to see if maybe you have the same problem.  If so, go to the next item 
in the thread to see Mark Hammond's suggested workaround.  That worked, 
and would have been fine with me, but the TLB's authors actually fixed 
the TLB as soon as I showed them the problem, so I didn't have to do 
anything funny.

Good luck.

- 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)



Mike Graham wrote, On 7/27/2009 12:30 PM:
> I used MakePy on a COM library with some success, but it does not seem
> to work with methods with passed-by-reference arguments. The
> documentation, as I understand it, says that the c_fun(in1, in2,
> *out1, *out2) should transform into (out1, out2) = py_fun(in1, in2).
>
> For example, MakePy makes me the method
>
> 	def PickObject(self, obj=defaultNamedNotOptArg,
> x=defaultNamedNotOptArg, y=defaultNamedNotOptArg,
> z=defaultNamedNotOptArg
> 			, obj_num=defaultNamedNotOptArg, entity_num=defaultNamedNotOptArg,
> tolerance=9.9999997473787516e-06, PType=0):
> 		"""Retrieve an object ID and face or edge number by giving an object
> type and global coordinates"""
> 		return self._ApplyTypes_(76, 1, (24, 0), ((16387, 3), (12, 1), (12,
> 1), (12, 1), (16387, 3), (16387, 3), (5, 49), (3, 49)), u'PickObject',
> None,obj
> 			, x, y, z, obj_num, entity_num
> 			, tolerance, PType)
>
> where obj_num and entity_num are outputs. I cannot call this with
> object.PickObject(10, 0, 0, 0) like I should be able to or with
> object.PickObject(10, 0, 0, 0, pythoncom.Empty, pythoncom.Empty),
> which I've seen suggested (or with anything else I've tried in the
> last spots).
>
> How do I get this to treat these arguments right?
> _______________________________________________
> 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