【发布时间】:2020-10-25 20:38:57
【问题描述】:
在尝试使用我过去使用的模板制作基于 Jupyter 的新演示文稿时,我发现当 nbconvert 升级到 6.0 以上时,我收到与缺少内置模板 @987654324 相关的错误@。一个最小的复制器,创建一个名为custom.tpl的模板文件:
{% extends 'basic.tpl' %}
然后使用任何 Jupyter 笔记本和 pip install jupyter nbconvert 并运行 nbconvert notebook.ipynb --to=slides --template=custom.tpl。你会得到这样的异常:
[NbConvertApp] Converting notebook example.ipynb to slides
Traceback (most recent call last):
File "/tmp/tmp.niaMlxSIbz/venv/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
...
File "/tmp/tmp.niaMlxSIbz/custom.tpl", line 1, in top-level template code
{% extends 'basic.tpl' %}
jinja2.exceptions.TemplateNotFound: basic.tpl
如果你pip install 'nbconvert < 6.0',你会发现同样的命令成功了。
我想这与changes to how templates work that came in 6.0 相关,但我相信.tpl 模板仍将被支持,甚至列出了PR that restores the basic template,但我在任何地方都找不到有关如何更新的说明我的模板,其中包含对新位置的引用。
有没有办法通过更改对'basic.tpl' 的引用来解决这个问题?
固定到 5.6.1“有效”,但 nbconvert 的 5.6.1 版不适用于 Python 3.9,我需要访问我笔记本中的一些较新的 Python 功能。
【问题讨论】:
标签: jupyter-notebook jupyter nbconvert