normanlorrain / mdpdf

Python command line application to convert Markdown to PDF.
MIT License
51 stars 10 forks source link

AttributeError: 'Document' object has no attribute 'pageCount' #10

Closed benpm closed 1 year ago

benpm commented 1 year ago

I'm trying to run a simple conversion and I get this error:

$ mdpdf Process-Book.md -o process-book.pdf

Traceback (most recent call last):
  File "/home/ben/.local/bin/mdpdf", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/cli.py", line 110, in cli
    converter.convert(globlist)
  File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/converter.py", line 18, in convert
    self.renderer.render(ast, inputFile)
  File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 73, in render
    getattr(self, node.t)(node, entering)
  File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 492, in document
    self.currentPage = self.doc.newPage(-1, width, height)
AttributeError: 'Document' object has no attribute 'newPage'. Did you mean: '_newPage'?
Exception ignored in: <function PdfRenderer.__del__ at 0x7ff1b30a9fc0>
Traceback (most recent call last):
  File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 51, in __del__
    if self.doc.pageCount:
AttributeError: 'Document' object has no attribute 'pageCount'

I'm using Python 3.10.6

normanlorrain commented 1 year ago

Hi, there was an update to the required PyMuPDF that changes pageCount to page_count.

I'll release a new version that fixes this in the next few days. If you need it urgently, you can try rolling back your version like so:

pip install pymupdf==1.19

-Norm

On Fri, 11 Nov 2022 at 16:19, Benjamin Mastripolito < @.***> wrote:

I'm trying to run a simple conversion and I get this error:

$ mdpdf Process-Book.md -o process-book.pdf

Traceback (most recent call last): File "/home/ben/.local/bin/mdpdf", line 8, in sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(args, **kwargs) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/cli.py", line 110, in cli converter.convert(globlist) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/converter.py", line 18, in convert self.renderer.render(ast, inputFile) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 73, in render getattr(self, node.t)(node, entering) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 492, in document self.currentPage = self.doc.newPage(-1, width, height) AttributeError: 'Document' object has no attribute 'newPage'. Did you mean: '_newPage'? Exception ignored in: <function PdfRenderer.del at 0x7ff1b30a9fc0> Traceback (most recent call last): File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 51, in del if self.doc.pageCount: AttributeError: 'Document' object has no attribute 'pageCount'

I'm using Python 3.10.6

— Reply to this email directly, view it on GitHub https://github.com/normanlorrain/mdpdf/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV73HPKBN2MJA5XRBNF43DWH3H7BANCNFSM6AAAAAAR6AKGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

normanlorrain commented 1 year ago

A new version is released. You should be able to pip uninstall mdpdf, then pip install mdpdf.

Not tested with the latest python. This is still 3.10.

-Norm

On Fri, 11 Nov 2022 at 16:47, Norman Lorrain @.***> wrote:

Hi, there was an update to the required PyMuPDF that changes pageCount to page_count.

I'll release a new version that fixes this in the next few days. If you need it urgently, you can try rolling back your version like so:

pip install pymupdf==1.19

-Norm

On Fri, 11 Nov 2022 at 16:19, Benjamin Mastripolito < @.***> wrote:

I'm trying to run a simple conversion and I get this error:

$ mdpdf Process-Book.md -o process-book.pdf

Traceback (most recent call last): File "/home/ben/.local/bin/mdpdf", line 8, in sys.exit(cli()) File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(args, **kwargs) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/cli.py", line 110, in cli converter.convert(globlist) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/converter.py", line 18, in convert self.renderer.render(ast, inputFile) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 73, in render getattr(self, node.t)(node, entering) File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 492, in document self.currentPage = self.doc.newPage(-1, width, height) AttributeError: 'Document' object has no attribute 'newPage'. Did you mean: '_newPage'? Exception ignored in: <function PdfRenderer.del at 0x7ff1b30a9fc0> Traceback (most recent call last): File "/home/ben/.local/lib/python3.10/site-packages/mdpdf/pdf_renderer.py", line 51, in del if self.doc.pageCount: AttributeError: 'Document' object has no attribute 'pageCount'

I'm using Python 3.10.6

— Reply to this email directly, view it on GitHub https://github.com/normanlorrain/mdpdf/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV73HPKBN2MJA5XRBNF43DWH3H7BANCNFSM6AAAAAAR6AKGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

benpm commented 1 year ago

Awesome, seems to work now