python - Jupyter Notebook to HTML - Notebook JSON 无效:['outputPrepend']
问题描述
我正在尝试将我的 Jupyter Notebook 文件 (.ipynb) 转换为 HTML 文件以便于阅读。每次我尝试保存笔记本时,都会收到“笔记本验证失败”错误:
Notebook validation failed: ['outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend'] has non-unique elements:
[
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend",
"outputPrepend"
]
当我尝试使用 File > Download as 下载为 .html 时,我得到了一个更详细的错误,但我仍然无法弄清楚它的含义或需要做什么来解决问题并最终下载为 HTML:
nbconvert failed: ['outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend', 'outputPrepend'] has non-unique elements
Failed validating 'uniqueItems' in code_cell['properties']['metadata']['properties']['tags']:
On instance['cells'][70]['metadata']['tags']:
['outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend',
'outputPrepend']
这只发生在我正在使用的特定笔记本上。我已尝试成功将其他笔记本保存并导出为 HTML。
任何帮助表示赞赏。谢谢
解决方案
我最近在使用 VSCode Notebook 编辑器时体验到了这一点。我通过在常规文本编辑器中打开笔记本并删除所有额外的项目来解决它,outputPrepend
每个数组中只留下一个。