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

TypeError: 'NoneType' object is not subscriptable in computed_values #1656

Closed
zopyx opened this issue Jun 10, 2022 · 1 comment
Closed

TypeError: 'NoneType' object is not subscriptable in computed_values #1656

zopyx opened this issue Jun 10, 2022 · 1 comment
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@zopyx
Copy link

zopyx commented Jun 10, 2022

WeasyPrint version 55.0 with the HTML/CSS source from https://www.antennahouse.com/xsl-fo-css-comparison gives me this error:


ERROR: Failed to load image at 'file:///Users/ajung/Downloads/xsl-fo-css-comparison-2022%20%281%29/img/typical-box-en.png': URLError: <urlopen error [Errno 2] No such file or directory: '/Users/ajung/Downloads/xsl-fo-css-comparison-2022 (1)/img/typical-box-en.png'>
ERROR: Failed to load image at 'file:///Users/ajung/Downloads/xsl-fo-css-comparison-2022%20%281%29/img/margin-boxes-en.png': URLError: <urlopen error [Errno 2] No such file or directory: '/Users/ajung/Downloads/xsl-fo-css-comparison-2022 (1)/img/margin-boxes-en.png'>
Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 8, in <module>
    sys.exit(main())
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/__main__.py", line 182, in main
    html.write_pdf(output, **kwargs)
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/__init__.py", line 177, in write_pdf
    self.render(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/__init__.py", line 128, in render
    return Document._render(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/document.py", line 319, in _render
    [Page(page_box) for page_box in page_boxes],
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/document.py", line 319, in <listcomp>
    [Page(page_box) for page_box in page_boxes],
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/__init__.py", line 128, in layout_document
    pages = list(make_all_pages(context, root_box, html, pages))
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/page.py", line 849, in make_all_pages
    page, resume_at = remake_page(i, context, root_box, html)
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/page.py", line 786, in remake_page
    page, resume_at, next_page = make_page(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/page.py", line 585, in make_page
    root_box, resume_at, next_page, _, _ = block_level_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 52, in block_level_layout
    return block_level_layout_switch(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 66, in block_level_layout_switch
    return block_box_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 108, in block_box_layout
    result = block_container_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 657, in block_container_layout
    next_page, new_children) = _in_flow_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 459, in _in_flow_layout
    collapsing_through) = block_level_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 52, in block_level_layout
    return block_level_layout_switch(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 66, in block_level_layout_switch
    return block_box_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 108, in block_box_layout
    result = block_container_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 657, in block_container_layout
    next_page, new_children) = _in_flow_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 459, in _in_flow_layout
    collapsing_through) = block_level_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 52, in block_level_layout
    return block_level_layout_switch(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 66, in block_level_layout_switch
    return block_box_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 108, in block_box_layout
    result = block_container_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 657, in block_container_layout
    next_page, new_children) = _in_flow_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 459, in _in_flow_layout
    collapsing_through) = block_level_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 52, in block_level_layout
    return block_level_layout_switch(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 66, in block_level_layout_switch
    return block_box_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 108, in block_box_layout
    result = block_container_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 646, in block_container_layout
    new_footnotes) = _linebox_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/block.py", line 306, in _linebox_layout
    for i, (line, resume_at) in enumerate(lines_iterator):
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/inline.py", line 38, in iter_line_boxes
    line, resume_at = get_next_linebox(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/inline.py", line 95, in get_next_linebox
    last_letter, float_width) = split_inline_box(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/inline.py", line 733, in split_inline_box
    split_inline_level(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/inline.py", line 468, in split_inline_level
    new_box, skip, preserved_line_break = split_text_box(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/layout/inline.py", line 904, in split_text_box
    layout, length, resume_index, width, height, baseline = split_first_line(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/text/line_break.py", line 321, in split_first_line
    layout = create_layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/text/line_break.py", line 258, in create_layout
    layout = Layout(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/text/line_break.py", line 64, in __init__
    self.setup(context, font_size, style)
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/text/line_break.py", line 98, in setup
    assert not isinstance(style['font_family'], str), (
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 631, in __missing__
    self[key] = self.parent_style[key]
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 696, in __missing__
    self[key] = value = self.parent_style[key]
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 696, in __missing__
    self[key] = value = self.parent_style[key]
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 696, in __missing__
    self[key] = value = self.parent_style[key]
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 729, in __missing__
    computed_values.compute_variable(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/computed_values.py", line 213, in compute_variable
    computed_value = _resolve_var(
  File "/opt/weasyprint/lib/python3.10/site-packages/weasyprint/css/computed_values.py", line 174, in _resolve_var
    computed_value = parent_style[new_variable_name] or new_default
TypeError: 'NoneType' object is not subscriptable
@liZe liZe added the crash Problems preventing documents from being rendered label Jun 10, 2022
@liZe liZe closed this as completed in 04e1ff2 Jun 10, 2022
@liZe liZe added this to the 56.0 milestone Jun 10, 2022
@liZe
Copy link
Member

liZe commented Jun 10, 2022

Thanks a lot for the bug report. It’s fixed in master and will be included in v56.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

2 participants