[omniORB] Package import troubles with omniORBpy

Todd Valentic valentic@fireball.sri.com
Wed, 19 Apr 2000 17:53:26 -0700 (PDT)


  Hi --

  I'm trying to convert an existing python application that uses Fnorb to 
  omniORB. I've got the omniORBpy distribution up and running fine, can
  run the examples and some test code, etc. The problem that I'm now running
  into deals with importing the modules produced by omniidl when they are
  part of a heirarchial package. 
 
  The IDL interface specification, omniidl output and python implementation
  code all reside in a directory named ${TOP}/sri/transport. My PYTHONPATH
  points to TOP and access to the modules in the directories is usually
  done by:

  from sri.transport import foobar

  Unfortunately, I'm having problems doing this with the omniORB classes.
  I have an IDL file named TransportModule.idl that defines a number of 
  classes, but as an example one is named ProcessGroup:

  module TransportModule {
    ...
	interface ProcessGroup {
	  ...
    };
  };

  Running this through omniidl -bpython results in the expected
  TransportModule/ POA_TransportModule/ and TransportModule_idl.py files
  being created. A client program would access the interface by importing:

  from sri.transport import TransportModule 

  However, the imported TransportModule at this point doesn't seem to have 
  anything defined for itself. Doing a dir(TransportModule) at this point 
  shows:

  ['TransportModule_idl', '__builtins__', '__doc__', '__file__',
  '__name__', '__path__']

  where as if I go to the directory itself and 'import TransportModule' and 
  look at the dir() output I get all the expected entries.

  This code has been working for some time under Fnorb. It looks like
  omniORB's module loading is more complicated, and I suspect the problem
  lies with the omniORB.openModule() calls in the _idl.py file.

  Does anybody include definitions like this or am I really bending things
  out of shape here? Any input or suggestions are welcome!

  Todd