Skip to content

nbconvert entrypoints.py glob fails #11512

@kkew3

Description

@kkew3

Problem: jupyter nbconvert --to ${anything} filename.ipynb fails, where ${anything} can be any format supported natively by nbconvert.

How to reproduce: under a directory containing square brackets in its name, create a virtualenv by python3 -m virtualenv rt && . rt/bin/activate && pip install jupyter. Then create an empty notebook file filename.ipynb. On terminal type, e.g., jupyter nbconvert --to html filename.ipynb. Then it fails.

Possible cause of the failure: line 157,158 of file ${VIRTUAL_ENV}/lib/python3.6/site-packages/entrypoints.py:

glob.iglob(osp.join(folder, '*.dist-info', 'entry_points.txt')), 
glob.iglob(osp.join(folder, '*.egg-info', 'entry_points.txt')) 

where glob.iglob treats the square brackets in folder as special character rather than string literal.

Possible solution: change these two lines to

glob.iglob(osp.join(glob.escape(folder), '*.dist-info', 'entry_points.txt')), 
glob.iglob(osp.join(glob.escape(folder), '*.egg-info', 'entry_points.txt')) 

Thanks for checking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions