当前位置:  开发笔记 > 编程语言 > 正文

iPython笔记本错误 - Notebook JSON无效:u'execution_count'是必需属性

如何解决《iPython笔记本错误-NotebookJSON无效:u'execution_count'是必需属性》经验,为你挑选了1个好方法。

我在运行我的iPython笔记本时遇到以下错误,并且想知道是否有人可以提供帮助.

我曾尝试浏览以前的帖子,但找不到答案.noteboook最终在Web浏览器上运行,但错误仍然出现.

控制台出错:

C:\Apps\Anaconda2\envs\simpleQT\python.exe
C:\Apps\Anaconda2\envs\simpleQT\Scripts\ipython-script.py notebook --no-browser --ip 127.0.0.1 --port 8888
[I 09:43:20.525 NotebookApp] The port 8888 is already in use, trying another random port.
[I 09:43:20.528 NotebookApp] Serving notebooks from local directory: C:\Users\Tanya.Sandoval\_QT\simpleQT
[I 09:43:20.528 NotebookApp] 0 active kernels 
[I 09:43:20.528 NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8889/
[I 09:43:20.528 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[E 09:43:37.553 NotebookApp] Notebook JSON is invalid: u'execution_count' is a required property

Failed validating u'required' in schema:
    {u'additionalProperties': False,
     u'description': u'Result of executing a code cell.',
     u'properties': {u'data': {u'$ref': u'#/definitions/misc/mimebundle'},
                     u'execution_count': {u'description': u"A result's prompt number.",
                                          u'minimum': 0,
                                          u'type': [u'integer', u'null']},
                     u'metadata': {u'$ref': u'#/definitions/misc/output_metadata'},
                     u'output_type': {u'description': u'Type of cell output.',
                                      u'enum': [u'execute_result']}},
     u'required': [u'output_type',
                   u'data',
                   u'metadata',
                   u'execution_count'],
     u'type': u'object'}

On instance:
    {u'data': {u'text/html': u'
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
OpenHighLowCloseVolume
Timestamp
2009-01-0215.9015.9515.3015.551065
2009-01-0515.9415.9415.3215.383710
2009-01-0615.6015.9015.4315.694619
2009-01-0715.7516.0415.4015.455956
2009-01-0815.4015.4514.4914.768454
2009-01-0914.6014.8014.4014.446846
2009-01-1214.4014.4013.7013.9410355
2009-01-1313.3014.0513.3013.7811341
2009-01-1413.9014.2513.2013.2811170
2009-01-1513.1713.6413.0713.259745
\n
'}, u'metadata': {}, u'output_type': u'execute_result'} [W 09:43:37.565 NotebookApp] Notebook notebook.ipynb is not trusted [I 09:43:38.515 NotebookApp] Kernel started: c8c37658-b072-4a1d-87c5-0f862f514e44

Web浏览器出错:

Notebook Validation failed: u'execution_count' is a required property:
{
 "output_type": "execute_result", 
 "data": {
  "text/html": "
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
OpenHighLowCloseVolume
Timestamp
2009-01-0215.9015.9515.3015.551065
2009-01-0515.9415.9415.3215.383710
2009-01-0615.6015.9015.4315.694619
2009-01-0715.7516.0415.4015.455956
2009-01-0815.4015.4514.4914.768454
2009-01-0914.6014.8014.4014.446846
2009-01-1214.4014.4013.7013.9410355
2009-01-1313.3014.0513.3013.7811341
2009-01-1413.9014.2513.2013.2811170
2009-01-1513.1713.6413.0713.259745
\n
" }, "metadata": {} }

有任何想法吗?谢谢!

更新

实际上这个错误只发生在我从PyCharm编辑器运行jupyter/ipython笔记本时.如果我在网络浏览器上运行它,错误就会消失.看起来PyCharm的笔记本兼容性仍然存在问题......



1> 小智..:

在笔记本上使用PyCharm后我遇到了同样的问题.

我可以通过简单地重新启动内核,清除所有输出并保存笔记本来使错误消失在浏览器中.

(内核/重启和清除输出)

推荐阅读
农大军乐团_697
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有