[omniORB] Global scope in omniORBpy
Leandro Fanzone
leandro@hasar.com
Mon Nov 25 16:28:01 2002
I have a small problem. Given the following IDLs:
p.idl:
interface if1
{
void f();
};
module m1
{
const long C1 = 1;
};
q.idl:
interface if2
{
void f();
};
module m2
{
const long C2 = 2;
};
from within python I want to import the interface if2:
>>> from _GlobalIDL import if2
and everything works as usual. Now if I first import m1 from p.idl:
>>> import m1
>>> from _GlobalIDL import f2
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: cannot import name if2.
This is because the "import m1" clause creates its own module _GlobalIDL
and any further "import _GlobalIDL" will do nothing, there is already a
_GlobalIDL name loaded. Importing a module defined in an IDL file that
also declares global symbols prevents any other global symbols from
other IDL files to be loaded in subsequent imports. A possible solution
could be to import _GlobalIDL before any other import.
Is this so by design?
Leandro Fanzone