takluyver / nbconvert-reportlab

MIT License
14 stars 4 forks source link

It does not work for me: no conversion, TypeError: escape_link() got an unexpected keyword argument 'quote' #3

Closed jmigartua closed 6 years ago

jmigartua commented 6 years ago

I am quite new to these kind of thins, so, please, sorry if the opened issue should not be. I have tried to convert a notebook, first in my "conda root", running python 2.7. Contacted Thomas, he suggested to run it in python 3.

I have created aPython 3.6 environment (conda create -n py36 python=3.6 anaconda). I have activated the environment and, then, I have installed nbconvert-reportlab: pip install nbconvert_reportlab. From there, I have tried the following command to convert the notebook: jupyter nbconvert --to pdf-rl 0_6_BigarrenPrintzipioa.ipynb

This is the error I get:

[NbConvertApp] Converting notebook 0_6_BigarrenPrintzipioa.ipynb to pdf-rl
Traceback (most recent call last):
  File "//anaconda/envs/py36/bin/jupyter-nbconvert", line 11, in <module>
    sys.exit(main())
  File "//anaconda/envs/py36/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 325, in start
    self.convert_notebooks()
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 493, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 464, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/nbconvertapp.py", line 393, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 174, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert/exporters/exporter.py", line 192, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert_reportlab/exporter.py", line 100, in from_notebook_node
    output = NbPdfConverter(nb_copy,  resources).go()
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert_reportlab/exporter.py", line 78, in go
    self.convert_markdown_cell(cell)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert_reportlab/exporter.py", line 43, in convert_markdown_cell
    self.pieces.extend(md_to_flowables(cell.source, self.stylesheet))
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert_reportlab/rlmarkdown.py", line 123, in md_to_flowables
    return converter.render(src)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 975, in render
    return self.parse(text)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 978, in parse
    out = self.output(preprocessing(text))
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 1027, in output
    out += self.tok()
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 1037, in tok
    return getattr(self, 'output_%s' % t)()
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 1142, in output_paragraph
    return self.renderer.paragraph(self.inline(self.token['text']))
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 529, in __call__
    return self.output(text, rules)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 559, in output
    ret = manipulate(text)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 553, in manipulate
    out = getattr(self, 'output_%s' % key)(m)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 615, in output_link
    return self._process_link(m, m.group(3), m.group(4))
  File "//anaconda/envs/py36/lib/python3.6/site-packages/mistune.py", line 635, in _process_link
    return self.renderer.image(link, title, text)
  File "//anaconda/envs/py36/lib/python3.6/site-packages/nbconvert_reportlab/rlmarkdown.py", line 28, in image
    src = mistune.escape_link(link, quote=True)
TypeError: escape_link() got an unexpected keyword argument 'quote'

Any help would be appreciated

takluyver commented 6 years ago

Thanks - the API of mistune changed slightly. Fix coming up.