mfontanini / presenterm-export

PDF exporter for presenterm presentations
BSD 2-Clause "Simplified" License
3 stars 0 forks source link

Getting 'presenterm-export' execution failed when export to PDF #8

Closed nivethan-me closed 3 months ago

nivethan-me commented 3 months ago

Hi, even after installing presenterm-export and weasyprint i'm still getting this error when i try to export as PDF.

OS : macOS Sonama 14.4.1

❯ presenterm-export --version
0.2.1
❯ tmux -V
tmux 3.4
❮ presenterm -e outlook-research-summary.md
tmux version: 3.4
Writing temporary files into /var/folders/1g/kbnv12xn2jjgjtfyhcmh7_100000gn/T/tmpsm1q3n23
Running presentation to capture slide...
Running '/opt/homebrew/bin/presenterm' '--export' '/Users/nivethan/Developer/allion/research-and-development/get-email-threads-outlook/outlook-research-summary.md'
Captured 1 slides so far...
Captured 2 slides so far...
Captured 3 slides so far...
Captured 4 slides so far...
Captured 5 slides so far...
Captured 5 slides
Converting slides to HTML...
Replacing images...
Generating PDF
'presenterm-export' execution failed:
Traceback (most recent call last):
  File "/Users/nivethan/.local/bin/presenterm-export", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 114, in main
    run(args, metadata)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 68, in run
    generate_pdf(presentation_html, presentation.size, options)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/pdf.py", line 63, in generate_pdf
mfontanini commented 3 months ago

I think you may be missing the last line that actually contains the error message. Could you double check please?

nivethan-me commented 3 months ago

I think you may be missing the last line that actually contains the error message. Could you double check please?

i tried again and this is all i'm getting though!

❯ presenterm -e demo.md
tmux version: 3.4
Writing temporary files into /var/folders/1g/kbnv12xn2jjgjtfyhcmh7_100000gn/T/tmp5rok9uux
Running presentation to capture slide...
Running '/opt/homebrew/bin/presenterm' '--export' '/Users/nivethan/Developer/code/md/presenterm/examples/demo.md'
Captured 1 slides so far...
Captured 2 slides so far...
Captured 3 slides so far...
Captured 4 slides so far...
Captured 5 slides so far...
Captured 6 slides so far...
Captured 7 slides so far...
Captured 8 slides so far...
Captured 9 slides so far...
Captured 10 slides so far...
Captured 10 slides
Converting slides to HTML...
Replacing images...
Transforming color block #ffbad3 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Transforming color block #ffbad4 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Generating PDF
'presenterm-export' execution failed:
Traceback (most recent call last):
  File "/Users/nivethan/.local/bin/presenterm-export", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 114, in main
    run(args, metadata)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 68, in run
    generate_pdf(presentation_html, presentation.size, options)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/pdf.py", line 63, in generate_pdf
    html.write_pdf(

presenterm/examples on master [!] took 9s
❯ ls
README.md code.md   demo.md   doge.png  footer.md
mfontanini commented 3 months ago

Ugh I see what's happening. Can you run this instead and paste the error? It does the same, the -e invocation does all of this under the hood:

presenterm --generate-pdf-metadata demo.md > /tmp/meta.json
presenterm-export /opt/homebrew/bin/presenterm --export /Users/nivethan/Developer/code/md/presenterm/examples/demo.md < /tmp/meta.json

(this needs those full paths and everything)

nivethan-me commented 3 months ago

Ugh I see what's happening. Can you run this instead and paste the error? It does the same, the -e invocation does all of this under the hood:

presenterm --generate-pdf-metadata demo.md > /tmp/meta.json
presenterm-export /opt/homebrew/bin/presenterm --export /Users/nivethan/Developer/code/md/presenterm/examples/demo.md < /tmp/meta.json

(this needs those full paths and everything)

this time i'm getting some different errors.

presenterm/examples on  master [!]
❯ presenterm --generate-pdf-metadata demo.md > /tmp/meta.json

presenterm/examples on  master [!]
❯ presenterm-export /opt/homebrew/bin/presenterm --export /Users/nivethan/Developer/code/md/presenterm/examples/demo.md < /tmp/meta.json
tmux version: 3.4
Writing temporary files into /var/folders/1g/kbnv12xn2jjgjtfyhcmh7_100000gn/T/tmp_kjfvaad
Running presentation to capture slide...
Running '/opt/homebrew/bin/presenterm' '--export' '/Users/nivethan/Developer/code/md/presenterm/examples/demo.md'
Captured 1 slides so far...
Captured 2 slides so far...
Captured 3 slides so far...
Captured 4 slides so far...
Captured 5 slides so far...
Captured 6 slides so far...
Captured 7 slides so far...
Captured 8 slides so far...
Captured 9 slides so far...
Captured 10 slides so far...
Captured 10 slides
Converting slides to HTML...
Replacing images...
Transforming color block #ffbad3 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Transforming color block #ffbad4 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Generating PDF
Traceback (most recent call last):
  File "/Users/nivethan/.local/bin/presenterm-export", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 114, in main
    run(args, metadata)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/cli.py", line 68, in run
    generate_pdf(presentation_html, presentation.size, options)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/presenterm_export/pdf.py", line 63, in generate_pdf
    html.write_pdf(
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/weasyprint/__init__.py", line 252, in write_pdf
    self.render(font_config, counter_style, **options)
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/weasyprint/document.py", line 399, in write_pdf
    pdf = generate_pdf(self, target, zoom, **options)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nivethan/.local/pipx/venvs/presenterm-export/lib/python3.12/site-packages/weasyprint/pdf/__init__.py", line 127, in generate_pdf
    pdf = pydyf.PDF((version or '1.7'), identifier)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: PDF.__init__() takes 1 positional argument but 3 were given
mfontanini commented 3 months ago

Hmm I think you may have incompatible versions of weasyprint and pydyf. The error is inside weasyprint so I don't think I can do much. If you pip freeze, which versions of those 2 are you using?

nivethan-me commented 3 months ago

Hmm I think you may have incompatible versions of weasyprint and pydyf. The error is inside weasyprint so I don't think I can do much. If you pip freeze, which versions of those 2 are you using?

i installed weasyprint using brew install weasyprint and i haven't installed pydyf directly. and i also don't have pip so i tried installing presentterm-export via pip3 pip3 install presenterm-export but i got an error which mentioned using pipx so i installed through that.

brew info don't show pydyf as dependecy here!

presenterm/examples on  master [!?] via 🐍 v3.12.4
❮ brew info weasyprint
==> weasyprint: stable 62.3 (bottled)
Convert HTML to PDF
https://www.courtbouillon.org/weasyprint
Installed
/opt/homebrew/Cellar/weasyprint/62.3 (892 files, 19MB) *
  Poured from bottle using the formulae.brew.sh API on 2024-07-17 at 00:37:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/w/weasyprint.rb
License: BSD-3-Clause
==> Dependencies
Required: pango ✔, pillow ✔, python@3.12 ✔
==> Analytics
install: 1,183 (30 days), 3,579 (90 days), 11,711 (365 days)
install-on-request: 1,183 (30 days), 3,579 (90 days), 11,710 (365 days)
build-error: 0 (30 days)
mfontanini commented 3 months ago

This should be fixed, can you install version 0.2.2 and give it a shot? pip3 install presenterm-export==0.2.2 should do it.

mfontanini commented 3 months ago

Joke, something's broken, gimme 5

mfontanini commented 3 months ago

Okay now it should be fixed in version 0.2.3. Can you try pip3 install presenterm-export==0.2.3 and let me know how it goes?

nivethan-me commented 3 months ago

Okay now it should be fixed in version 0.2.3. Can you try pip3 install presenterm-export==0.2.3 and let me know how it goes?

just upgraded to 0.2.3 and now its working as expected 😀 thank you so much for your quick response and solution

❮ presenterm -e demo.md
tmux version: 3.4
Writing temporary files into /var/folders/1g/kbnv12xn2jjgjtfyhcmh7_100000gn/T/tmppio5p4zx
Running presentation to capture slide...
Running '/opt/homebrew/bin/presenterm' '--export' '/Users/nivethan/Developer/code/md/presenterm/examples/demo.md'
Captured 1 slides so far...
Captured 2 slides so far...
Captured 3 slides so far...
Captured 4 slides so far...
Captured 5 slides so far...
Captured 6 slides so far...
Captured 7 slides so far...
Captured 8 slides so far...
Captured 9 slides so far...
Captured 10 slides so far...
Captured 10 slides
Converting slides to HTML...
Replacing images...
Transforming color block #ffbad3 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Transforming color block #ffbad4 into image /Users/nivethan/Developer/code/md/presenterm/examples/doge.png
Generating PDF
PDF generation finished, output PDF is at /Users/nivethan/Developer/code/md/presenterm/examples/demo.pdf