ipython / ipython/ipykernel

Import issue: AttributeError: 'NoneType' object has no attribute 'session'

未关闭
#552 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
734
派生
412
平均合并
1 天 5 小时
30 天内合并 PR
8

描述

When import the package inside VScode I get an error:
```

Traceback (most recent call last):
File ".\dpseg.py", line 379, in
run()
File ".\dpseg.py", line 320, in run
cerebro.plot()
File "C:\ProgramData\Anaconda3\lib\site-packages\backtrader\cerebro.py", line 996, in plot
plotter.show()
File "C:\ProgramData\Anaconda3\lib\site-packages\backtrader\plot\plot.py", line 817, in show
self.mpyplot.show()
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\pyplot.py", line 272, in show
return _show(*args, **kw)
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 261, in show
manager.show()
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 90, in show
self._create_comm()
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 122, in _create_comm
self.add_web_socket(comm)
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_webagg_core.py", line 433, in add_web_socket
self.resize(w, h)
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_webagg_core.py", line 417, in resize
self._send_event(
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_webagg_core.py", line 490, in _send_event
s.send_json(payload)
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 199, in send_json
self.comm.send({'data': json.dumps(content)})
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\ipykernel\comm\comm.py", line 122, in send
self._publish_msg('comm_msg',
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\ipykernel\comm\comm.py", line 66, in _publish_msg
self.kernel.session.send(self.kernel.iopub_socket, msg_type,
AttributeError: 'NoneType' object has no attribute 'session'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\_pylab_helpers.py", line 72, in destroy_all
manager.destroy()
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 126, in destroy
self._send_event('close')
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_webagg_core.py", line 490, in _send_event
s.send_json(payload)
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\matplotlib\backends\backend_nbagg.py", line 199, in send_json
self.comm.send({'data': json.dumps(content)})
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\ipykernel\comm\comm.py", line 122, in send
self._publish_msg('comm_msg',
File "C:\Users\Mislav\AppData\Roaming\Python\Python38\site-packages\ipykernel\comm\comm.py", line 66, in _publish_msg
self.kernel.session.send(self.kernel.iopub_socket, msg_type,
AttributeError: 'NoneType' object has no attribute 'session'
```
I have found similar issue few years old, but I don't understand what is the solution to this. It is mentioning jupyter notebook. Do I have to use this package only inside jupyter?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。