Open levi-ee opened 1 year ago
I can't reproduce this. Which version of nbconvert
are you using, and can you share a notebook you have this issue with?
Version: 7.7.1
A notebook with just this python cell is enough:
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.show()
I was able to find a way to make it work, but it still not clear to me...
I think that it can be a Windows/WSL issue, but I don't know why it works with --to notebook
but not with --to markdown
.
Using the following gen_md.sh
bash script:
#!/bin/bash
jupyter nbconvert sinus_generation.ipynb \
--Exporter.preprocessors='["nbconvert.preprocessors.ExecutePreprocessor"]' \
--to markdown
If I first open wsl.exe and run the script, it works:
$ ./gen_md.sh
/home/cc/.local/lib/python3.8/site-packages/traitlets/traitlets.py:2930: FutureWarning: --Exporter.preprocessors=["nbconvert.preprocessors.ExecutePreprocessor"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.
warn(
[NbConvertApp] Converting notebook sinus_generation.ipynb to markdown
[NbConvertApp] Support files will be in sinus_generation_files/
[NbConvertApp] Writing 26039 bytes to sinus_generation.md
But if I run wsl.exe "./gen_md.sh"
from a Windows CMD it fails:
C:\dev\issue_nbconvert>wsl.exe "./gen_md.sh"
[NbConvertApp] Converting notebook sinus_generation.ipynb to markdown
[NbConvertApp] Executing notebook with kernel: python3
Traceback (most recent call last):
...
jinja2.exceptions.UndefinedError: 'nbformat.notebooknode.NotebookNode object' has no attribute 'filenames'
To fix that, I simply created an equivalent batch script when I'm running Windows, and it works.
A notebook with just this python cell is enough:
That is exactly what I tried as well, so I'm not really sure what is going on.
Hello,
Due to #1300 I'm trying to use
--Exporter.preprocessors='["nbconvert.preprocessors.ExecutePreprocessor","nbconvert.preprocessors.TagRemovePreprocessor"]'
While it works with
--to notebook
I have the following error with--to markdown
:I guess this is normal as
NotebookNode
may be only used for notebook export (?). Is there a way to make the workaround in #1300 work for Markdown ?