You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
converting to pdf (Webpdf) and pagination works well :
> jupyter nbconvert --to WebPDF --theme light --execute --allow-errors TP.ipynb
[NbConvertApp] Converting notebook TP.ipynb to WebPDF
[NbConvertApp] Building PDF
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 124332 bytes to TP.pdf
but it fails without pagination :
> jupyter nbconvert --to WebPDF --WebPDFExporter.paginate=False --theme light --execute --allow-errors TP.ipynb
[NbConvertApp] Converting notebook TP.ipynb to WebPDF
[NbConvertApp] Building PDF
Traceback (most recent call last):
File "/usr/bin/jupyter-nbconvert", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3.12/site-packages/jupyter_core/application.py", line 283, in launch_instance
super().launch_instance(argv=argv, **kwargs)
File "/usr/lib/python3.12/site-packages/traitlets/config/application.py", line 1075, in launch_instance
app.start()
File "/usr/lib/python3.12/site-packages/nbconvert/nbconvertapp.py", line 420, in start
self.convert_notebooks()
File "/usr/lib/python3.12/site-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/lib/python3.12/site-packages/nbconvert/nbconvertapp.py", line 563, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/templateexporter.py", line 386, in from_filename
return super().from_filename(filename, resources, **kw) # type:ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/exporter.py", line 201, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/templateexporter.py", line 392, in from_file
return super().from_file(file_stream, resources, **kw) # type:ignore[return-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/exporter.py", line 220, in from_file
return self.from_notebook_node(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/webpdf.py", line 174, in from_notebook_node
pdf_data = self.run_playwright(html)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/webpdf.py", line 163, in run_playwright
pdf_data = pool.submit(run_coroutine, main(temp_file)).result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/webpdf.py", line 161, in run_coroutine
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/nbconvert/exporters/webpdf.py", line 134, in main
pdf_data = await page.pdf(**pdf_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/playwright/async_api/_generated.py", line 11359, in pdf
await self._impl_obj.pdf(
File "/usr/lib/python3.12/site-packages/playwright/_impl/_page.py", line 1084, in pdf
encoded_binary = await self._channel.send("pdf", params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 59, in send
return await self._connection.wrap_api_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.pdf: width: expected string, got number
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x75c3b5eb4ea0>
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
File "/usr/lib/python3.12/asyncio/unix_events.py", line 767, in close
File "/usr/lib/python3.12/asyncio/unix_events.py", line 753, in write_eof
File "/usr/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-121' coro=<Connection.run() running at /usr/lib/python3.12/site-packages/playwright/_impl/_connection.py:274> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Then, it works, without pagination.
(More precisely, there is no error, I get the PDF, with one long page... and a few lines on a second page. Whatever the size of the initial notebook, the result is always one long page plus a few lines. I can get a single page with "height": str(min(height + 2 * 72, 200 * 72)),.
I don't know if this error is from my particular installation (Arch, I installed nbconvert with the distro packet manager, not from github), so I did not submit a pull request. Let me know if its helps
The text was updated successfully, but these errors were encountered:
converting to pdf (Webpdf) and pagination works well :
but it fails without pagination :
I had to modify
/exporters/webpdf.py
:is modified to :
Then, it works, without pagination.
(More precisely, there is no error, I get the PDF, with one long page... and a few lines on a second page. Whatever the size of the initial notebook, the result is always one long page plus a few lines. I can get a single page with
"height": str(min(height + 2 * 72, 200 * 72)),
.I don't know if this error is from my particular installation (Arch, I installed nbconvert with the distro packet manager, not from github), so I did not submit a pull request. Let me know if its helps
The text was updated successfully, but these errors were encountered: