[omniORB] Problem with struct parameters

Bailey, Kendall BaileyK at schneider.com
Tue Mar 3 10:15:09 GMT 2009


As meth() is a method of a class, it should have an argument called "self".  In C++ and Java, there's an implicit "this" parameter, but in Python the reference to the target of the method call must be explicitly listed first in the argument list.  By convention it is called "self".  Take a look at this link for the details:

http://www.python.org/doc/2.6/tutorial/classes.html



-------------------------------------------------
Kendall Bailey


-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com [mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Piet van Oostrum
Sent: Tuesday, March 03, 2009 10:06 AM
To: omniorb-list at omniorb-support.com
Subject: [omniORB] Problem with struct parameters

I have a problem with a struct parameter in omniORBpy. It looks similar
to a problem that appeared on this list 2 weeks ago ("Caught an
unexpected Python exception during up-call") but the situation is quite
different. 

I am using omniORB 4.1.3 and omniORBpy-3.3 on MacOS X 10.4 with Python
version 2.6.

I have the following idl:

------------------------------------------------------------------------
module Test {

	struct hist {
		long lower;	    
		long higher;	
	};

	interface Try {
		void meth (out hist h);
	};
};
------------------------------------------------------------------------

The server implementation of the method is:

------------------------------------------------------------------------
    def meth():
        return hist(1, 10)
------------------------------------------------------------------------
because out parameters are implemented as results.

the client code is:

------------------------------------------------------------------------
print server.meth()
------------------------------------------------------------------------

I get an exception:
------------------------------------------------------------------------
omniORB: Caught an unexpected Python exception during up-call.
TypeError: meth() takes no arguments (1 given)
Traceback (most recent call last):
  File "client.py", line 30, in <module>
    print server.meth()
  File "/Users/piet/colleges/GOB/examples/Corba/TestStructOut/strout_idl.py", line 61, in meth
    return _omnipy.invoke(self, "meth", _0_Test.Try._d_meth, args)
omniORB.CORBA.UNKNOWN: CORBA.UNKNOWN(omniORB.UNKNOWN_PythonException, CORBA.COMPLETED_MAYBE)
------------------------------------------------------------------------

Where does this argument come from? It is not in my client code. Also if
I change the method in the IDL to return the struct instead of using an
out parameter it gives the same error.

Am I doing something wrong? Is this a bug? Or is omniorbpy incompatible
with python 2.6?
-- 
Piet van Oostrum <piet at cs.uu.nl>



More information about the omniORB-list mailing list