Skip to content

Commit

Permalink
Merge pull request #6170 from ccordoba12/fix-attr-error-after-reset
Browse files Browse the repository at this point in the history
PR: Catch error when resetting console namespace and no kernel_client is available
  • Loading branch information
ccordoba12 authored Jan 8, 2018
2 parents b6c0532 + ad01836 commit 8636cb0
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions spyder/widgets/ipythonconsole/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 8636cb0

Please sign in to comment.