question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError when restarting kernel on Windows

See original GitHub issue

Description

What steps will reproduce the problem?

When some code is in debug (I use breakpoint()), the error occurs when closing the console using the ‘x’. If I stop the debug mode or press the black stop button first, it does not occur.

Traceback

--- Logging error ---
Traceback (most recent call last):
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '9ba3286fa1a511eba4f5fcaa14552b99'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\scripts\spyder.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\start.py", line 213, in main
    mainwindow.main(options, args)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('9ba3286fa1a511eba4f5fcaa14552b99',)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 113, in get_comm
    return self.comms[comm_id]
KeyError: '9ba3286fa1a511eba4f5fcaa14552b99'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\logging\__init__.py", line 1084, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\scripts\spyder.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\start.py", line 213, in main
    mainwindow.main(options, args)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\mainwindow.py", line 2311, in main
    mainwindow = create_window(app, splash, options, args)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\spyder\app\mainwindow.py", line 2207, in create_window
    app.exec_()
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 48, in _dispatch
    getattr(self, msg_type)(msg)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 172, in comm_msg
    comm = self.get_comm(comm_id)
  File "C:\Python\WPy64-3880\python-3.8.8.amd64\lib\site-packages\qtconsole\comms.py", line 117, in get_comm
    self.log.warning("No such comm: %s", comm_id)
Message: 'No such comm: %s'
Arguments: ('9ba3286fa1a511eba4f5fcaa14552b99',)

Versions

  • Spyder version: 5.0.1
  • Python version: 3.8.8
  • Qt version: 5.12.10
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  3.0.4 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.21.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.0 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.8.0 (OK)
pylint >=1.0                  :  2.7.1 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2           :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.0.3             :  5.0.3 (OK)
qtpy >=1.5.0                  :  1.10.0.dev0 (OK)
setuptools >=39.0.0           :  54.1.0 (OK)
sphinx >=0.6.6                :  3.5.1 (OK)
spyder_kernels >=2.0.1;<2.1.0 :  2.0.1 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  22.0.3 (OK)

# Optional:
cython >=0.21                 :  0.29.22 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.20.1 (OK)
pandas >=1.1.1                :  1.2.3 (OK)
scipy >=0.17.0                :  1.6.1 (OK)
sympy >=0.7.3                 :  1.7.1 (OK)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
stonebigcommented, Apr 22, 2021

thanks for the discovery of the “< details >” markdown, will re-use it

0reactions
Patrick-Colecommented, Apr 23, 2021

Thanks very much - keep up the awesome work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - How to Restart & Run All code if there is a Key Error ...
1 Answer 1 · Try to import a package · If it fails (KeyError, ImportError, etc), pip install it and force a kernel...
Read more >
Event ID 41 The system has rebooted without cleanly shutting ...
When a computer shuts down or restarts because of a Stop error, Windows includes the Stop error data in Event ID 41 as...
Read more >
kernel32.dll error? registry key error? ...what do you think?
Hi there. Last week, whenever I would click on my Avast! tray icon, my computer would restart. When attempting to disable it from...
Read more >
unable to save webmap from notebook - Esri Community
I am learning Python through ArcGIS Notebooks. In the lesson: https://www.arcgis.com/home/item.html?id=5aee4d0f252941e1ae421b78a8ccbe60.
Read more >
Dead Kernel, Jupyter Notebook : Forums - PythonAnywhere
The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found