Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object is not subscriptable on some inputs #609

Closed
snoyberg opened this issue Apr 2, 2018 · 2 comments
Closed

object is not subscriptable on some inputs #609

snoyberg opened this issue Apr 2, 2018 · 2 comments

Comments

@snoyberg
Copy link

snoyberg commented Apr 2, 2018

I've worked this down to as minimal a repro as I could on my machine. I have the following contents in an HTML file:

<meta charset="utf-8">
<p>XXXXXXX <code>xxxxxxxx</code> into your CI environment is very
easy, there are executable versions of the tool for some of the most
common Operating Systems available
on <a href="https://github.com/fpco/cache-s3/releases">github release
page</a> and examples on how to automate its downloading is described
in <a href="https://github.com/fpco/cache-s3#downloading-the-executable">Downloading
the executable</a> section. If you are looking for some examples on
how to implement your CI build script, <a href="/">.avis.yml</a></p>

When I run WeasyPrint on this (version 0.42.2), I get the following output:

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/weasyprint/__main__.py", line 177, in main
    getattr(html, 'write_' + format_)(output, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/__init__.py", line 182, in write_pdf
    font_config=font_config).write_pdf(
  File "/usr/local/lib/python3.6/site-packages/weasyprint/__init__.py", line 143, in render
    font_config)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/document.py", line 326, in _render
    [Page(p, enable_hinting) for p in page_boxes],
  File "/usr/local/lib/python3.6/site-packages/weasyprint/document.py", line 326, in <listcomp>
    [Page(p, enable_hinting) for p in page_boxes],
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/__init__.py", line 55, in layout_document
    context, root_box, html, cascaded_styles, computed_styles))
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 601, in make_all_pages
    context, root_box, page_type, resume_at, page_number)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/pages.py", line 520, in make_page
    positioned_boxes, positioned_boxes, adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 638, in block_container_layout
    adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 638, in block_container_layout
    adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 83, in block_level_layout
    adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 111, in block_box_layout
    page_is_empty, absolute_boxes, fixed_boxes, adjoining_margins)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/blocks.py", line 510, in block_container_layout
    for line, resume_at in lines_iterator:
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 51, in iter_line_boxes
    device_size, absolute_boxes, fixed_boxes, first_letter_style)
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 108, in get_next_linebox
    waiting_floats, line_children=[])
  File "/usr/local/lib/python3.6/site-packages/weasyprint/layout/inlines.py", line 839, in split_inline_box
    child_resume_at[0] + current_skip,
TypeError: 'NoneType' object is not subscriptable

I'm running this on an OS X machine, and am happy to provide any further information that may be relevant.

Side note: thank you very much for this project, it's by far the best I've seen at respecting CSS print rules, which has been invaluable (and way nicer than using XSLFO).

@Tontyna
Copy link
Contributor

Tontyna commented Apr 3, 2018

Duplicate of #580, fixed in 0.42.3

@snoyberg
Copy link
Author

snoyberg commented Apr 3, 2018

Thank you for the quick response! I can confirm that this fixes it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants