[omniORB] Passing a Sequence from Python to C++

entonh at gmx.de entonh at gmx.de
Tue Feb 19 07:43:10 GMT 2008


Hello,

I just found your answer and already tried it.
But like in my post before I'm getting the error:
TypeError: Argument must be CORBA class or repository id.

How can I solve this?

I tried both methods...and both ended up in the same error.

Greetings,
EntonH

-------- Original-Nachricht --------
> Datum: Mon, 18 Feb 2008 14:25:40 +0000
> Von: Duncan Grisby <duncan at grisby.org>
> An: EntonH <entonh at gmx.de>
> CC: omniorb-list at omniorb-support.com
> Betreff: Re: [omniORB] Passing a Sequence from Python to C++

> On Sunday 17 February, EntonH wrote:
> 
> [...]
> > struct param
> > {
> > 	string value1;
> > 	any value2;
> > };
> > 	
> > typedef sequence param ParSeq;
> > 
> > any init(in ParSeq par_list);
> > 
> > So you think this should work?
> > 
> > list1 = []
> > list1.append(
> > idlfile.param("Character",CORBA.Any(CORBA.TC_string,"good")))
> > list1.append( idlfile.param("Age",CORBA.Any(CORBA._tc_long,long(24))))
> 
> This is fine so far, although the mapping for CORBA long is Python int,
> not Python long (which is an arbitrary scale integer). long can be used
> where int is expected, though, so you'll get away with it.
> 
> > list2 = []
> > list2.append(
> idlfile.param("Character",CORBA.Any(CORBA.TC_string,"bad")))
> > list2.append( idlfile.param("Age",CORBA.Any(CORBA._tc_long,long(27))))
> > 
> > list_all =  []
> > list_all.append (idlfile.param("1",CORBA.Any(CORBA._tc_any,list1)))
> > list_all.append (idlfile.param("2",CORBA.Any(CORBA._tc_any,list2)))
> 
> This is the problem. You're setting the value in the struct to an Any
> that itself claims to contain an Any, but you've put in a list of param
> structs. It will work if you use idlfile._tc_ParSeq, which is the
> TypeCode of your ParSeq typedef.
> 
> This seems like a very contrived and complex example.
> 
> Duncan.
> 
> -- 
>  -- Duncan Grisby         --
>   -- duncan at grisby.org     --
>    -- http://www.grisby.org --

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger



More information about the omniORB-list mailing list