On 17/12/2012 12:54 AM, Dave Calkins wrote:

On 12/16/2012 12:46 AM, Mark Hammond wrote:
That's very strange.  pywin32 *will* be passing a second param - a
byref bstr.  byref params do work in general, so you might need to
contact the vendor of the object for help.

Cheers,

Mark

I'm the vendor of the object :)  As I mentioned, I just created this
small test app which reproduces the issue having just those 3 simple
methods.  However, I'm not able to talk to it via Python.

Is the source to this available?

It seems to
be a pretty simple interface.  Any idea what else I might be missing?
What do I need to do on the python side to call that method with the out
params?

Nope - it should all be good.  For example, check out:

http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/8b73631eeee0/com/TestSources/PyCOMTest/PyCOMTest.idl#l193

http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/8b73631eeee0/com/TestSources/PyCOMTest/PyCOMImpl.cpp#l133

and (slightly cryptic) Python code which calls it:

http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/8b73631eeee0/com/win32com/test/testPyComTest.py#l225

Which shows some "out" param tests (and while there is an inout bstr test, there doesn't seem to be a specific test for an out bstr, so it's still possible you have hit a pywin32 bug)

You indicated that the out params should be converted to a return
value.  Why does the MakePy generated method signature not indicate
this?  i.e. why does it show 2 arguments?

The makepy signature really just reflects the params passed to the interface itself - hence those params all have default values.

You said above that pywin32 *will* be passing a second param - a byref
bstr.  That suggests to me that there's some other method I need to call
which internally calls the real method from pywin32. Where is the method
I need to call then?  I don't see any method generated there with only a
single arg?

InvokeTypes is what does all the magic - it takes the VT_* values and builds real params in C++, and also builds the tuple (if necessary) which is returned. The params mainly exist for when the interface is *implemented* by Python rather than when called by Python - the same generated classes are used in both directions.

Hope this clarifies...

Mark

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

Reply via email to