Skip to content


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

nMustaki opened this Issue · 7 comments

2 participants



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/", line 79, in main
    getattr(html, 'write_' + format_)(output, stylesheets=args.stylesheet)
  File "/usr/lib/python3.2/site-packages/weasyprint/", line 124, in write_pdf
    return document.write_pdf(target)
  File "/usr/lib/python3.2/site-packages/weasyprint/", line 171, in write_pdf
    pdf.write_pdf_metadata(self, file_obj)
  File "/usr/lib/python3.2/site-packages/weasyprint/", line 420, in write_pdf_metadata
    bookmarks, links = gather_metadata(document)
  File "/usr/lib/python3.2/site-packages/weasyprint/", line 416, in gather_metadata
    return process_bookmarks(bookmarks), resolved_links_by_page
  File "/usr/lib/python3.2/site-packages/weasyprint/", line 319, in process_bookmarks
    k += 1 + level_shifts.pop()
IndexError: pop from empty list

I need more data, do tell me

Kozea member

Hi Nathan,

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


Sure, I forgot to do it, sorry !

Kozea member

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

Désolé d’insister :)


Looks like I was out of it yesterday !
GIst updated :

Kozea member

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

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.


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.