Re: [Orbit-python-list] TypeCode and Anys?
Status: Inactive
Brought to you by:
tack
|
From: Gustavo C. <gj...@in...> - 2002-04-26 17:32:11
|
I was having the same doubts as you some time ago. In fact I still do!
But I have discovered that CORBA::any's work anyway if you don't care
about corba type codes. Say you have this:
result =3D some_corba_object.some_method_that_returns_any(foo,bar)
Then, you can get the value as:
value =3D result.value
Then, value is a standard python object, and you can use python's type
system to differentiate types. For example, if the CORBA::any is of type
TC_CORBA_string, you the following expression is true:
type(value) is StringType
Don't ask me how to create CORBA::any from python, though, as I
haven't tried that yet.
On Fri, 2002-04-26 at 17:34, Thomas Lockhart wrote:
> I'm looking at using python and ORBit for some applications in a large
> distributed realtime system (for which the primary ORB is TAO; JacORB
> and Mico are used also). Some of the interfaces use Anys, and I'm trying
> to get my first application working with them. I've got some questions
> (feel free to answer one or several rather than waiting for someone who
> knows them all ;)...
>=20
> I cribbed a snippet of code from the test-suite part of the
> orbit-python-0.3.1 tarball which packages a simple Any for return by a
> server. But I'm not successfully finding the type code in that example,
> getting an error thrown (tested with both ORBit-0.5.8 and -0.5.15). The
> traceback sez:
>=20
> tc =3D CORBA.TypeCode("IDL:CORBA:String/1.0")
> TypeError: Unregistered repoid IDL:CORBA:String/1.0
>=20
> So, (1) what do I need to do to get a fundamental type code recognized?
> (2) How would I discover which type codes are available (in case I have
> a typo here)? If I was generating stubs, I'd cheat and look in the stubs
> for these signatures. But with the nice dynamic loading features of O-P,
> I don't have a static file to look at. I'm not particularly experienced
> with python, so newbie hints are welcome.
>=20
> If I try using this same call in a server object, I get a different kind
> of error:
>=20
> AttributeError: class TypeError has no attribute '__repo_id'
> Traceback (most recent call last):
> File "conflite.py", line 43, in LoadConfiguration
> tc =3D CORBA.TypeCode("IDL:CORBA:String/1.0")
> TypeError: Unregistered repoid IDL:CORBA:String/1.0
>=20
> which I'm guessing means that I don't have my server object inheriting
> from the right built-in object or objects which would give me that
> __repo_id internal attribute. (3) Any hints on what I'm missing here?
>=20
> btw, O-P seems to work with the TAO naming service and with simple
> examples just fine. I'm looking forward to doing more...
>=20
> Regards.
>=20
> - Thomas
>=20
> _______________________________________________
> Orbit-python-list mailing list
> Orb...@li...
> https://lists.sourceforge.net/lists/listinfo/orbit-python-list
--=20
Gustavo Jo=E3o Alves Marques Carneiro
<gj...@in...> <gu...@us...>
|