Repository: spyder-ide/spyder

Issue:
Dicom plugin error in bootstrap.py
Having just pulled the latest master I'm getting the below error in the `bootstrap.py` script? Are others seeing this?

```
0x. Enforcing parent console (Windows only)
04. Executing spyder.main()
ERROR: 3rd party plugin import failed for `spyplugins.io.dicom`
Traceback (most recent call last):
  File "C:\Users\Dave\Code\spyder\spyderlib\otherplugins.py", line 74, in _import_plugin
    module = loader.load_module(name)
AttributeError: 'NoneType' object has no attribute 'load_module'
ERROR: 3rd party plugin import failed for `spyplugins.io.dicom`
Traceback (most recent call last):
  File "C:\Users\Dave\Code\spyder\spyderlib\otherplugins.py", line 74, in _import_plugin
    module = loader.load_module(name)
AttributeError: 'NoneType' object has no attribute 'load_module'
Bootstrap completed in 00:00:01.5320
```



Discussion:
What python version ?

`dicom` was renamed to `dcm`. You just need to run:

```
rm -R spyplugins/io/dicom
```

(or the Windows equivalent) to make the error go away :-)

---

@goanpeca, we need to add simple check in `_import_plugin` to avoid this error in the future. Could you take care of it?

@ccordoba12 Yep, will do, why was it renamed?

@PierreRaybaut renamed it. I think he did it because the Python module to work with Dicom files changed its name.

@goanpeca, could you do the PR tomorrow? I need this for beta2 ;-)

Give me a sec, will do it now

Ok, thanks!


Resolving patch:
diff --git a/spyderlib/otherplugins.py b/spyderlib/otherplugins.py
--- a/spyderlib/otherplugins.py
+++ b/spyderlib/otherplugins.py
@@ -63,28 +63,31 @@ def _import_plugin(name, base_namespace, plugin_namespace, namespace_path,
         return
     try:
         # First add a mock module with the LOCALEPATH attribute so that the
-        # helper method can fin the locale on import
+        # helper method can find the locale on import
         mock = _ModuleMock()
         mock.LOCALEPATH = osp.join(namespace_path, name, 'locale')
         sys.modules[module_name] = mock
-
+        module = None
         if PY33:
             loader = importlib.machinery.PathFinder.find_module(
                 name, [namespace_path])
-            module = loader.load_module(name)
+            if loader:
+                module = loader.load_module(name)
         elif PY3:
             spec = importlib.machinery.PathFinder.find_spec(name,
                                                             [namespace_path])
-            module = spec.loader.load_module(name)
+            if spec:
+                module = spec.loader.load_module(name)
         else:
             info = imp.find_module(name, [namespace_path])
-            module = imp.load_module(module_name, *info)
+            if info:
+                module = imp.load_module(module_name, *info)
 
         # Then restore the actual loaded module instead of the mock
-        sys.modules[module_name] = module
-
-        modlist.append(module)
-        modnames.append(module_name)
+        if module:
+            sys.modules[module_name] = module
+            modlist.append(module)
+            modnames.append(module_name)
     except Exception:
         sys.stderr.write("ERROR: 3rd party plugin import failed for "
                          "`{0}`\n".format(module_name))


Test patch: