Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
Why can't I import xyz IDL data definition from abc IDL namespace?
There are a few possibilities:
import ACS import Control #the Control IDL module includes IDL files which utilize the "ACS" IDL module
is OK, while there's a strong possibility:
import Control import ACS
will throw an exception after the import ACS
statement.
module xyz
in IDL where xyz
is a reserved keyword in Python. Look at the IDL->Python CORBA Mapping Specifications available from OMG's website to determine what Python module xyz
gets mapped to.How you import your IDL interfaces has a great impact on which interfaces are available in your IDL module (namespace). If you have not previously imported the IDL module but you request one of its interfaces, the interface loading code will create the IDL (namespace) module for you and populate it with the information from that single interface. Subsequent interface loads will add to this dynamically created IDL (namespace) module. Depending on how many interfaces you load and their dependencies, you may end up with a IDL (namespace) module that contains a small subset of the interfaces.
The fix for this problem is to reload the IDL (namespace) module. This action will force all of the interfaces in the module to be loaded from disk.
To illustrate the fix, here is an example. Suppose the code that is failing in your program looks like this:
myModule = __import__("Module", globals(), locals(), ["MyClass"]) myClass = myModule.__dict__.get("MyClass") # Returns None because "Module" isn't completely loaded myObject = myClass() # Fails because instance is None
You can force Module to be reloaded by doing the following:
myModule = __import__("Module", globals(), locals(), ["MyClass"]) myClass = myModule.__dict__.get("MyClass") # Returns None because "Module" isn't completely loaded if myClass is None: reload(myModule) # Reloads "Module" from the file system myClass = myModule.__dict__.get("MyClass") # Returns "MyClass" if it is defined in the "Module" myObject = myClass() # Works now