Skip to content

Loading…

[bug][Python3.2][Archlinux] IndexError: pop from empty list #2

Closed
nMustaki opened this Issue · 7 comments

2 participants

@nMustaki

Hello,

First of all, thanks for the great work !
I installed Weasyprint with the AUR package, and I am getting this error while trying to generate a pdf for a text-only page (the only css is a class for page-break) :

weasyprint http://localhost:1291/pdf/Hisdesat test.pdf
Traceback (most recent call last):
  File "/usr/bin/weasyprint", line 9, in <module>
    load_entry_point('WeasyPrint==0.11', 'console_scripts', 'weasyprint')()
  File "/usr/lib/python3.2/site-packages/weasyprint/__main__.py", line 79, in main
    getattr(html, 'write_' + format_)(output, stylesheets=args.stylesheet)
  File "/usr/lib/python3.2/site-packages/weasyprint/__init__.py", line 124, in write_pdf
    return document.write_pdf(target)
  File "/usr/lib/python3.2/site-packages/weasyprint/document.py", line 171, in write_pdf
    pdf.write_pdf_metadata(self, file_obj)
  File "/usr/lib/python3.2/site-packages/weasyprint/pdf.py", line 420, in write_pdf_metadata
    bookmarks, links = gather_metadata(document)
  File "/usr/lib/python3.2/site-packages/weasyprint/pdf.py", line 416, in gather_metadata
    return process_bookmarks(bookmarks), resolved_links_by_page
  File "/usr/lib/python3.2/site-packages/weasyprint/pdf.py", line 319, in process_bookmarks
    k += 1 + level_shifts.pop()
IndexError: pop from empty list

I need more data, do tell me

@SimonSapin
Kozea member

Hi Nathan,

Thanks for reporting this. Could you provide the HTML and CSS you used, so we can reproduce the bug?

@nMustaki

Sure, I forgot to do it, sorry !
https://gist.github.com/3152429

@SimonSapin
Kozea member

Hum, this is plain text. I’d need the HTML source.

Désolé d’insister :)

@nMustaki

Looks like I was out of it yesterday !
GIst updated : https://gist.github.com/3152429

@SimonSapin
Kozea member

Great! I can reproduce the bug. I’ll have a look at it.

@SimonSapin
Kozea member

The bug occurred with some inconsistent sequence for title levels like <h1>, <h3>, <h2>. We chose not to have blank entries in the PDF output so there is an algorithm that does some transformation. In your document, <h4> titles will not all be at the same depth.

@nMustaki

Thanks you very much, I am glad this ill-coded html could help you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.