kynan/nbstripout

Nbdime error on Windows with nbstripout

Closed this issue · 2 comments

Hey,

We got an issue reported in jupyterlab/jupyterlab-git#471 (comment) when using nbstripout and nbdime on Windows.

I was able to reproduce that issue on the following system:

  • Windows 10 x64
  • Relevant packages
# Name                    Version                   Build  Channel
jupyterlab-git            0.9.0                     dev_0    <develop>
nbdime                    1.1.0                    pypi_0    pypi
nbformat                  4.4.0                      py_1    conda-forge
nbstripout                0.3.7                      py_0    conda-forge
notebook                  6.0.1                    py37_0    conda-forge
python                    3.7.6                h5b45d93_1    conda-forge

Digging into that issue, nbdime finds out the filter applied on the notebook by querying the git config command. Then it applies the obtained command on the file before processing with the diff operation.

On Windows, git uses a unix shell. But nbdime with that logic uses the native shell of the OS. And in the particular case of nbstripout, it is failing.

  • Call from nbdime
subprocess.CalledProcessError: Command ''C:/Users/freud/Anaconda3/envs/jlab/python.exe' -m nbstripout' returned non-zero exit status 1.
  • Call executed directly in Windows shell:
(jlab) ...\jupyterlab-git\examples>'C:/Users/freud/Anaconda3/envs/jlab/python.exe' -m nbstripout < demo.ipynb
''C:' is not recognized as valid command

The error raises due to the use of single quote in

filepath = "'{}' -m nbstripout".format(sys.executable.replace('\\', '/'))

Using double quote " removes the error.

@kynan Any chance of this getting merged in the near future?

kynan commented

Sorry for the slow response. This will go out in 0.3.8