From: caremoli Date: Wed, 9 Feb 2011 17:07:29 +0000 (+0000) Subject: CCAR: import_hook.py was too strict in ensure_list (ImportError raised) X-Git-Tag: Start_BR_19998_21191~75 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cbeb1b9ad4789b0fe4ea7f8efcaf98f7f8fec2f6;p=modules%2Fkernel.git CCAR: import_hook.py was too strict in ensure_list (ImportError raised) numpy.test() (1.5.1) fails in embedded console Now if the subelement does not exist, it is ignored --- diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index d812d8f67..fcbdb1602 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -160,9 +160,9 @@ def ensure_fromlist(m, fromlist, recursive=0): else: subname="%s.%s" % (m.__name__, sub) submod = import_module(sub, subname, m) - if not submod: - raise ImportError, "No module named " + subname - l.append((subname,submod)) + #if not found ignore it + if submod: + l.append((subname,submod)) return l def import_hook(name, globals=None, locals=None, fromlist=None, *args, **kwds):