Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54104

Python -COMMETHOD ,No return value obtained/received

Newsgroups comp.lang.python
Date 2013-09-12 22:55 -0700
Message-ID <35d91bea-39ec-461c-8ec7-194dcd308428@googlegroups.com> (permalink)
Subject Python -COMMETHOD ,No return value obtained/received
From sanju dhoomakethu <otlasanju@gmail.com>

Show all headers | View raw


I am very new to COM programming, Our project requires the Python script to make communication with a COM dll which is written in C#.

The generated COM signature in Python is as below

COMMETHOD([dispid(1610743820)], HRESULT, 'test',
          ( ['in', 'out'], POINTER(_midlSAFEARRAY(c_double)), 'test' ),
          ( ['retval', 'out'], POINTER(VARIANT_BOOL), 'pRetVal' )),
Where as the C# code for the same is

public bool test(ref double[,] test)
        {
            if (test == null)
                test = new double[1,2];


            test[0,0] = 0.0;
            test[0,1] = 0.5;

            return true;
        }
Note: the above is the dummy functions i have created to explain the issue

Now when I try to invoke the COM method from Python , I am only getting the values passed by reference to the method (sweepValuesX) as return value and not the actual return value (which has to be either true/false)

My function call is as below

print apxWrapper.test()
and the output is ((0.0, 0.5),)

Note: Since i was not able to find a way to pass the last arguement from Python ,I just omitted the last argument for trial purpose

Any hints why this is happening is highly appreciated or to be specific I have two questions

1> How Can i pass the argument to be passed by reference from Python especially array (both single and multidimensional)(POINTER(_midlSAFEARRAY(c_double)))
2> How can i get the actual return value (true/false)
Sanjay

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Python -COMMETHOD ,No return value obtained/received sanju dhoomakethu <otlasanju@gmail.com> - 2013-09-12 22:55 -0700

csiph-web