Salome HOME
PR: bug PAL 13665 and EDF 311
authorprascle <prascle>
Mon, 23 Oct 2006 07:46:01 +0000 (07:46 +0000)
committerprascle <prascle>
Mon, 23 Oct 2006 07:46:01 +0000 (07:46 +0000)
src/KERNEL_PY/import_hook.py

index 904e3d441e08df5e8bb560df82479855b0706b41..e3e744a81cf8744ee5898062c0b35fb94fe8bec4 100755 (executable)
@@ -149,7 +149,12 @@ def import_hook(name, globals=None, locals=None, fromlist=None):
        #when fromlist is not specified and name is a dotted name,
        # module is the root package not the real module
        #so we need to retrieve it
-       m=get_real_module(module,name)
+       # note: some modules like xml.dom do not play the rule
+       # (import xml: no attribute dom, but import xml.dom OK)
+       try:
+           m=get_real_module(module,name)
+       except AttributeError:
+           m=None
 
     if type(m) == type(sys) and is_shared(m.__name__):
        set_shared_imported(m.__name__,m)