How to get return value from COM object method.

Hi All,

I am calling a Com method from python. I want to get the return value of COM method

COM method has following parameters [in, out], [out], and [out, retval]

public bool SomeFunc(ref string name, int age)

{

/*…

do some work

…*/

return true

}

In Python, I am doing somethiong like this:

from comtypes.client import CreateObject

comObj = CreateObject("…")

name = “abc”

print comObj.SomeFunc(“abc”, 5,)

It just returns msg

If I am trying something like this:

name = “abc”

ret = False

comIObj.SomeFunc(“abc”, 5, ret)

It is throwing error saying TypeError: expected 3 parameters 4 given

Can anybody point me out what’s going wrong here

Is there a way to get boolean ret value from the method???

···


Keep Rocking…

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

This is error I am getting while accessing the method:

Traceback (most recent call last):
File “C:\Documents and Settings\paswal\Desktop\com_test.py”, line 19, in
print SomeFunc(name, age, ret)
File “C:\Python26\lib\site-packages\comtypes_init_.py”, line 604, in call_with_inout

rescode = func(self_, *args, **kw)

TypeError: call takes exactly 3 arguments (4 given)

···

On 10 May 2010 18:49, prakash aswal prakash.aswal@gmail.com wrote:

Hi All,

I am calling a Com method from python. I want to get the return value of COM method

COM method has following parameters [in, out], [out], and [out, retval]

public bool SomeFunc(ref string name, int age)

{

/*…

do some work

…*/

return true

}

In Python, I am doing somethiong like this:

from comtypes.client import CreateObject

comObj = CreateObject(“…”)

name = “abc”

print comObj.SomeFunc(“abc”, 5)

It prints just value of name.

If I am trying something like this:

name = “abc”

ret = False

comIObj.SomeFunc(“abc”, 5, ret)

It is throwing error saying TypeError: expected 3 parameters 4 given

Can anybody point me out what’s going wrong here

Is there a way to get boolean ret value from the method???


Keep Rocking…


Keep Rocking…

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Have you tried asking people in the comtypes project?

···

On 5/10/10 6:19 AM, prakash aswal wrote:

Hi All,
I am calling a Com method from python. I want to get the return value of
COM method

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hey Robin,

Can you please point me to any such mail list where I can get answer for this question?

Thanks,

Prakash

···

On 10 May 2010 23:38, Robin Dunn robin@alldunn.com wrote:

On 5/10/10 6:19 AM, prakash aswal wrote:

Hi All,
I am calling a Com method from python. I want to get the return value of
COM method

Have you tried asking people in the comtypes project?


Robin Dunn
Software Craftsman
http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en


Keep Rocking…

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

http://lmgtfy.com/?q=python+comtypes+mailing+list

Click the PyPI link and you're there!

···

On May 11, 7:36 am, prakash aswal <prakash.as...@gmail.com> wrote:

Hey Robin,

Can you please point me to any such mail list where I can get answer for
this question?

Thanks,
Prakash

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

http://sourceforge.net/projects/comtypes/support

···

On 5/11/10 5:36 AM, prakash aswal wrote:

Hey Robin,
Can you please point me to any such mail list where I can get answer for
this question?

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en