Repository: spyder-ide/spyder

Issue:
AttributeError when resetting console namespace
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

```python-traceback
  File "d:\miniconda\lib\site-packages\spyder\widgets\ipythonconsole\client.py", line 530, in reset_namespace
    message=True)
  File "d:\miniconda\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 261, in reset_namespace
    self.reset()
  File "d:\miniconda\lib\site-packages\qtconsole\frontend_widget.py", line 665, in reset
    self._show_interpreter_prompt()
  File "d:\miniconda\lib\site-packages\qtconsole\jupyter_widget.py", line 348, in _show_interpreter_prompt
    msg_id = self.kernel_client.execute('', silent=True)
AttributeError: 'NoneType' object has no attribute 'execute'
```

## Version and main components

* Spyder Version: 3.2.5 
* Python Version: 3.6.1
* Qt Versions: 5.9.3, PyQt5 5.9.2 on Windows

## Dependencies
```
pyflakes >=0.6.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.1 (OK)
sphinx >=0.6.6   :  1.6.5 (OK)
rope >=0.9.4     :  0.10.7 (OK)
jedi >=0.9.0     :  0.11.1 (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.2.1 (OK)
pylint >=0.25    :  1.7.4 (OK)

```

  


Discussion:
Thanks for reporting. We'll fix this problem in our 3.2.6 version (to be released in some hours).

Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py
--- a/spyder/widgets/ipythonconsole/shell.py
+++ b/spyder/widgets/ipythonconsole/shell.py
@@ -253,23 +253,26 @@ def reset_namespace(self, warning=False, silent=True, message=False):
             if answer != QMessageBox.Yes:
                 return
 
-        if self._reading:
-            self.dbg_exec_magic('reset', '-f')
-        else:
-            if silent:
-                if message:
-                    self.reset()
-                    self._append_html(_("<br><br>Removing all variables..."
-                                        "\n<hr>"),
-                                      before_prompt=False)
-                self.silent_execute("%reset -f")
-                self.refresh_namespacebrowser()
+        try:
+            if self._reading:
+                self.dbg_exec_magic('reset', '-f')
             else:
-                self.execute("%reset -f")
+                if silent:
+                    if message:
+                        self.reset()
+                        self._append_html(_("<br><br>Removing all variables..."
+                                            "\n<hr>"),
+                                          before_prompt=False)
+                    self.silent_execute("%reset -f")
+                    self.refresh_namespacebrowser()
+                else:
+                    self.execute("%reset -f")
 
-            if not self.external_kernel:
-                self.silent_execute(
-                    'get_ipython().kernel.close_all_mpl_figures()')
+                if not self.external_kernel:
+                    self.silent_execute(
+                        'get_ipython().kernel.close_all_mpl_figures()')
+        except AttributeError:
+            pass
 
     def create_shortcuts(self):
         """Create shortcuts for ipyconsole."""


Test patch: