Jupyter Notebook to HTML - Notebook JSON 无效:['outputPrepend']

Jau*_*ave 8 python jupyter-notebook

我正在尝试将我的 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"
]
Run Code Online (Sandbox Code Playgroud)

保存文件时的消息

当我尝试使用 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']
Run Code Online (Sandbox Code Playgroud)

尝试下载为 HTML 时的消息

这仅发生在我正在处理的特定笔记本上。我曾尝试将其他笔记本成功保存并导出为 HTML。

任何帮助表示赞赏。谢谢

Jac*_*zen 14

我最近在使用 VSCode Notebook 编辑器时遇到了这种情况。我通过在常规文本编辑器中打开笔记本并删除所有额外outputPrepend项来解决它,在每个数组中只留下一个。