Bug 267212 - devel/py-nbconvert 7.2.1 fails to run option --to script
Summary: devel/py-nbconvert 7.2.1 fails to run option --to script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-python (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-19 22:49 UTC by p5B2EA84B3
Modified: 2022-10-24 19:12 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (python)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description p5B2EA84B3 2022-10-19 22:49:40 UTC
> jupyter nbconvert --to script some_notebook.ipynb 
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 645, in get
    value = obj._trait_values[self.name]
KeyError: 'template_paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-nbconvert", line 33, in <module>
    sys.exit(load_entry_point('nbconvert==7.2.1', 'console_scripts', 'jupyter-nbconvert')())
  File "/usr/local/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/traitlets/config/application.py", line 978, in launch_instance
    app.start()
  File "/usr/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 426, in start
    self.convert_notebooks()
  File "/usr/local/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 594, in convert_notebooks
    cls = get_exporter(self.export_format)
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 106, in get_exporter
    if getattr(exporter(config=config), "enabled", True):
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 342, in __init__
    super().__init__(config=config, **kw)
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 118, in __init__
    self._init_preprocessors()
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 508, in _init_preprocessors
    conf = self._get_conf()
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 526, in _get_conf
    for path in map(Path, self.template_paths):
  File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 686, in __get__
    return self.get(obj, cls)
  File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 648, in get
    default = obj.trait_defaults(self.name)
  File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1752, in trait_defaults
    return self._get_trait_default_generator(names[0])(self)
  File "/usr/local/lib/python3.9/site-packages/traitlets/traitlets.py", line 1132, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 537, in _template_paths
    template_names = self.get_template_names()
  File "/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 621, in get_template_names
    raise ValueError(
ValueError: No template sub-directory with name 'script' found in the following paths:
	/home/user/.local/share/jupyter
	/usr/local/share/jupyter
	/usr/share/jupyter

The last ipynb to py conversion (--to script) here was done 2022-07-08 so a version after that introduced this bug.
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-10-24 19:10:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=06b53a2e9d8049ea97dc24094fd18b1cb77cf053

commit 06b53a2e9d8049ea97dc24094fd18b1cb77cf053
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2022-10-24 19:09:23 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2022-10-24 19:09:23 +0000

    devel/py-nbconvert: Update to 7.2.2

    And add a workaround to install templates to fix `jupyter nbconvert`
    command. [1]

    PR:             267212 [1]
    Reported by:    p5B2EA84B3@t-online.de [1]

 devel/py-nbconvert/Makefile        |  6 ++++-
 devel/py-nbconvert/distinfo        |  6 ++---
 devel/py-nbconvert/pkg-plist (new) | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 4 deletions(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-10-24 19:12:11 UTC
A commit in branch 2022Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=45325db27d4f9f52cd337075e0aee82c1c0b02dc

commit 45325db27d4f9f52cd337075e0aee82c1c0b02dc
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2022-10-24 19:09:23 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2022-10-24 19:11:30 +0000

    devel/py-nbconvert: Update to 7.2.2

    And add a workaround to install templates to fix `jupyter nbconvert`
    command. [1]

    PR:             267212 [1]
    Reported by:    p5B2EA84B3@t-online.de [1]

    (cherry picked from commit 06b53a2e9d8049ea97dc24094fd18b1cb77cf053)

 devel/py-nbconvert/Makefile        |  6 ++++-
 devel/py-nbconvert/distinfo        |  6 ++---
 devel/py-nbconvert/pkg-plist (new) | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 4 deletions(-)