[omniORB] Python mapping for IDL struct

Adam Groszer adamg@mailbox.hu
Mon Mar 10 15:44:26 2003


You get the error because IPAddress is defined with typedef.

You can write in the IDL:
        typedef sequence<long,4> IPAddress;
and use in python:
        ip=[192,168,123,1]
        print ip[0]

or as a second choice:
IDL:
        struct IPAddress {
            long  _1;
            long  _2;
            long  _3;
            long  _4;
          };
python:
        ip=IPAddress(192,168,123,1)
        print ip._1

I hope I missed nothing :-)

Adam

-----Original Message-----
From: omniorb-list-admin@omniorb-support.com
[mailto:omniorb-list-admin@omniorb-support.com]On Behalf Of
ondrej@frcatel.fri.utc.sk
Sent: Monday, 2003 March 10. 3:03 PM
To: omniorb-list@omniorb-support.com
Subject: [omniORB] Python mapping for IDL struct


Hi everybody,

 I am writing a small content management system and at this moment I am
developing a session manager. I have an IDL like

module Open1to1 {

  typedef long IPAddress[4];

 interface SessionManager {
        string enterSession(in long time,in IPAddress ip);
 };
};

I would like to write a Python client to server implementing this
interface (SessionManager).

I do standard stuff in startup (proved to work). The issue is, that when I
try to create a variable to hold input data for enterSession() call, I get
error.

ip = Open1to1.IPAddress()

Traceback (most recent call last):
  File "./create_session.py", line 34, in ?
    ip = Open1to1.IPAddress();
  File "./session_manager_idl.py", line 49, in __init__
    raise RuntimeError("Cannot construct objects of this type.")
RuntimeError: Cannot construct objects of this type.

Why am I receiving that error message ?

                                Ondrej

_______________________________________________
omniORB-list mailing list
omniORB-list@omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list