Repository: spyder-ide/spyder

Issue:
ImportError when trying to load third-party plugins
<!--- **PLEASE READ:** Before submitting here, please carefully consult our *Troubleshooting Guide*: https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ and search the issues page for your error/problem, as most posted bugs are duplicates or easy fixes.

If you don't find anything, please provide a detailed step-by-step description (in English) of the problem and what led up to it below. Issue reports without a clear way to reproduce them will be closed. Thanks! --->

## Problem Description

I'm not entirely sure what the effects of this error are, and its doesn't seem to have a negative impact on my uses for spyder. The GUI still opens successfully and I can load, edit, and save files. I figured I'd report this error just in case its resolution can be useful for others. 

Error appeared more or less randomly today and is raised everytime I start it up now. Error first appeared on v3.2.6, but is still appearing after update to v3.2.8 today.

### Traceback
```python-traceback
  File "/Users/kevinamses/miniconda2/lib/python2.7/site-packages/spyder/otherplugins.py", line 85, in _import_plugin
    module = _import_module_from_path(module_name, plugin_path)
  File "/Users/kevinamses/miniconda2/lib/python2.7/site-packages/spyder/otherplugins.py", line 107, in _import_module_from_path
    info = imp.find_module(module_name, [plugin_path])
ImportError: No module named spyder_projects
```

## Package Versions

* Spyder version: 3.2.8 
* Python version: 2.7.14
* Qt version: 5.6.2
* PyQt5 version: 5.6
* Operating system: Darwin 15.6.0

### Dependencies

```
pyflakes >=0.5.0  :  1.6.0 (OK)
pycodestyle >=2.3 :  2.3.1 (OK)
pygments >=2.0    :  2.2.0 (OK)
pandas >=0.13.1   :  0.20.3 (OK)
numpy >=1.7       :  1.13.3 (OK)
sphinx >=0.6.6    :  1.6.3 (OK)
rope >=0.9.4      :  0.10.5 (OK)
jedi >=0.9.0      :  0.10.2 (OK)
psutil >=0.3      :  5.4.0 (OK)
nbconvert >=4.0   :  5.3.1 (OK)
sympy >=0.7.3     :  None (NOK)
cython >=0.21     :  None (NOK)
qtconsole >=4.2.0 :  4.3.1 (OK)
IPython >=4.0;<6.0:  5.4.1 (OK)
pylint >=0.25     :  1.7.4 (OK)
```




Discussion:

Resolving patch:
diff --git a/spyder/otherplugins.py b/spyder/otherplugins.py
--- a/spyder/otherplugins.py
+++ b/spyder/otherplugins.py
@@ -103,27 +103,20 @@ def _import_module_from_path(module_name, plugin_path):
     Return None if no module is found.
     """
     module = None
-    if PY2:
-        info = imp.find_module(module_name, [plugin_path])
-        if info:
-            module = imp.load_module(module_name, *info)
-    elif sys.version_info[0:2] <= (3, 3):
-        loader = importlib.machinery.PathFinder.find_module(
-            module_name,
-            [plugin_path])
-        if loader:
-            module = loader.load_module(module_name)
-    else:  # Python 3.4+
-        spec = importlib.machinery.PathFinder.find_spec(
-            module_name,
-            [plugin_path])
-        if spec:
-            # Needed to prevent an error when 'spec.loader' is None
-            # See issue 6518
-            try:
+    try:
+        if PY2:
+            info = imp.find_module(module_name, [plugin_path])
+            if info:
+                module = imp.load_module(module_name, *info)
+        else:  # Python 3.4+
+            spec = importlib.machinery.PathFinder.find_spec(
+                module_name,
+                [plugin_path])
+            if spec:
                 module = spec.loader.load_module(module_name)
-            except AttributeError:
-                module = None
+    except Exception:
+        pass
+
     return module
 
 


Test patch: