Nbconvert: jupyter nbconvert error: pattern matched no files, if filename contains `[]`

Created on 8 Aug 2018  路  5Comments  路  Source: jupyter/nbconvert

If nbconvert-ing a file containing [ ] characters, it throws error. For example:

(base) E:\project_amanah\WorkshopML\Day 3>jupyter nbconvert "Day 3-1, Hands-on Deep Learning [2].ipynb" --to slides --post serve

[NbConvertApp] WARNING | pattern 'Day 3-1, Hands-on Deep Learning [2].ipynb' matched no files

This application is used to convert notebook files (*.ipynb) to various other
formats.
...

Version: jupyter 4.4.0, python 3.6, Windows 10, Anaconda

Workaround: Rename the filename to e.g. Day 3-1, Hands-on Deep Learning2.ipynb (remove the [ ] characters)

workaround known

Most helpful comment

Same issue confirmed on Linux, nbconvert version 5.4.0.dev0, jupyter 4.4.0, python 3.6.6

All 5 comments

Confirming I also ran into this issue on on jupyter version 4.4.0, python 3.5.

Same issue confirmed on Linux, nbconvert version 5.4.0.dev0, jupyter 4.4.0, python 3.6.6

It's trying to use the names you give it as glob patterns to match multiple files, and square brackets have meaning for glob patterns.

@takluyver we ended up solving this by replacing [ with [[] and ] with []]

In general, if you have a string that has a globing issue, you can do

import glob
print(glob.escape(...))

on your problem string to find the workaround.

Here is the relevant code:

https://github.com/jupyter/nbconvert/blob/a6f89c3ea214ec9abe126f85b5a810216d4c9ab4/nbconvert/nbconvertapp.py#L314

We could add a

globbed_files.append(glob.glob(glob.escape(pattern)))
globbed_files.append(glob.glob(glob.escape(pattern+'ipynb')))

to fix this completely.

Was this page helpful?
0 / 5 - 0 ratings