Skip to content

Commit

Permalink
IPython Console: Handle case when kernel fault file doesn't exist and…
Browse files Browse the repository at this point in the history
… show error with info explainig no connection was possible
  • Loading branch information
dalthviz committed Oct 2, 2024
1 parent 7ee5a49 commit 0fee65d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions spyder/plugins/ipythonconsole/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,10 +1395,19 @@ def _kernel_restarted_message(self, died=True):
and not self.is_remote()
):
# The kernel might never restart, show position of fault file
msg += (
"\n" + _("Its crash file is located at:") + " "
+ self.kernel_handler.fault_filename()
)
# if available else show kernel error
if self.kernel_handler.fault_filename():
msg += (
"\n" + _("Its crash file is located at:") + " "
+ self.kernel_handler.fault_filename()
)
else:
self.ipyclient.show_kernel_error(
_("Unable to connect with the kernel. If you are trying "
"to connect to an existing kernel check that the "
"connection file actually corresponds with the kernel "
"you want to connect to")
)

self._append_html(f"<br>{msg}<br>", before_prompt=False)
self.insert_horizontal_ruler()
Expand Down

0 comments on commit 0fee65d

Please sign in to comment.