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

SVG: crash on draw_pattern #1394

Closed
takesson opened this issue Jul 11, 2021 · 3 comments
Closed

SVG: crash on draw_pattern #1394

takesson opened this issue Jul 11, 2021 · 3 comments
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@takesson
Copy link

I will send a sample svg privately.

Traceback (most recent call last):
  File "/usr/local/bin/weasyprint", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/weasyprint/__main__.py", line 214, in main
    html.write_pdf(output, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/__init__.py", line 180, in write_pdf
    self.render(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/document.py", line 1048, in write_pdf
    page.paint(stream, scale=scale)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/document.py", line 730, in paint
    draw_page(self._page_box, context)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 69, in draw_page
    draw_stacking_context(stream, stacking_context)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 183, in draw_stacking_context
    draw_stacking_context(stream, child_context)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 178, in draw_stacking_context
    draw_inline_level(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 959, in draw_inline_level
    draw_inline_level(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 965, in draw_inline_level
    draw_replacedbox(stream, box)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 920, in draw_replacedbox
    box.replacement.draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/images.py", line 106, in draw
    self._svg.draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 333, in draw
    self.draw_node(self.tree, size('12pt'))
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 377, in draw_node
    self.draw_node(child, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 377, in draw_node
    self.draw_node(child, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 385, in draw_node
    self.fill_stroke(node, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 553, in fill_stroke
    fill_drawn = draw_gradient_or_pattern(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 66, in draw_gradient_or_pattern
    return draw_pattern(svg, node, svg.patterns[name], font_size, stroke)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 523, in draw_pattern
    Pattern(pattern, svg.url).draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 333, in draw
    self.draw_node(self.tree, size('12pt'))
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 377, in draw_node
    self.draw_node(child, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 372, in draw_node
    TAGS[node.tag](self, node, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 43, in use
    if tree.tag in ('svg', 'symbol'):
AttributeError: 'NoneType' object has no attribute 'tag'
@liZe
Copy link
Member

liZe commented Jul 12, 2021

Hello!

This exact bug is already fixed on master, but there’s another problem that we can fix too.

@liZe liZe closed this as completed in 231736d Jul 12, 2021
@liZe liZe added this to the 53.0 milestone Jul 12, 2021
@liZe liZe added the crash Problems preventing documents from being rendered label Jul 12, 2021
@liZe
Copy link
Member

liZe commented Jul 12, 2021

The bug is now fixed. There’s another fix for image size management that could be useful for you (cef8cf1).

@takesson
Copy link
Author

Confirmed fixed on master.

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