Catch error when shutting down kernel from the control channel #877
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Traceback (most recent call last): File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/kernelbase.py", line 285, in process_control await result File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/kernelbase.py", line 814, in shutdown_request content = self.do_shutdown(parent['content']['restart']) File "/home/carlos/Projects/spyder/github‑repo/external‑deps/spyder‑kernels/spyder_kernels/console/kernel.py", line 105, in do_shutdown super(SpyderKernel, self).do_shutdown(restart) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/ipkernel.py", line 513, in do_shutdown self.shell.exit_now = True File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 606, in __set__ self.set(obj, value) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 595, in set obj._notify_trait(self.name, old_value, new_value) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1224, in _notify_trait type='change', File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1229, in notify_change return self._notify_observers(change) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/traitlets/traitlets.py", line 1266, in _notify_observers c(event) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/zmqshell.py", line 472, in _update_exit_now exit_hook(self.kernel) File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/site‑packages/ipykernel/eventloops.py", line 289, in loop_tk_exit kernel.app_wrapper.app.destroy() File "/home/carlos/miniconda3/envs/spyder‑stable‑cf/lib/python3.7/tkinter/__init__.py", line 2062, in destroy self.tk.call('destroy', self._w) RuntimeError: main thread is not in main loop