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

AttributeError: 'Pattern' object has no attribute 'use_cache' #1558

Closed
takesson opened this issue Jan 31, 2022 · 1 comment
Closed

AttributeError: 'Pattern' object has no attribute 'use_cache' #1558

takesson opened this issue Jan 31, 2022 · 1 comment
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@takesson
Copy link

takesson commented Jan 31, 2022

One of our documents work fine on 53.0 / 53.4 but fails with 54.1.

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 188, in main
    html.write_pdf(output, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/__init__.py", line 183, in write_pdf
    self.render(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/document.py", line 1204, in write_pdf
    page.paint(stream, scale=scale)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/document.py", line 809, in paint
    draw_page(self._page_box, stream)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 73, in draw_page
    draw_stacking_context(stream, stacking_context)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 186, in draw_stacking_context
    draw_stacking_context(stream, child_context)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 181, in draw_stacking_context
    draw_inline_level(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 972, in draw_inline_level
    draw_inline_level(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 976, in draw_inline_level
    draw_replacedbox(stream, box)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/draw.py", line 939, in draw_replacedbox
    box.replacement.draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/images.py", line 91, in draw
    self._svg.draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 361, in draw
    self.draw_node(self.tree, size('12pt'))
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 428, in draw_node
    self.draw_node(child, font_size, fill_stroke)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 428, in draw_node
    self.draw_node(child, font_size, fill_stroke)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 437, in draw_node
    self.fill_stroke(node, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 607, in fill_stroke
    fill_drawn = draw_gradient_or_pattern(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 76, in draw_gradient_or_pattern
    return draw_pattern(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 506, in draw_pattern
    Pattern(pattern, svg).draw(
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 361, in draw
    self.draw_node(self.tree, size('12pt'))
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 742, in draw_node
    super().draw_node(node, font_size, fill_stroke=True)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 428, in draw_node
    self.draw_node(child, font_size, fill_stroke)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 742, in draw_node
    super().draw_node(node, font_size, fill_stroke=True)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/__init__.py", line 421, in draw_node
    TAGS[node.tag](self, node, font_size)
  File "/usr/local/lib/python3.9/site-packages/weasyprint/svg/defs.py", line 30, in use
    if parsed_url.fragment in svg.use_cache:
AttributeError: 'Pattern' object has no attribute 'use_cache'
@takesson takesson changed the title Failure AttributeError: 'Pattern' object has no attribute 'use_cache' Jan 31, 2022
@liZe liZe closed this as completed in d60433a Feb 6, 2022
@liZe liZe added the crash Problems preventing documents from being rendered label Feb 6, 2022
@liZe
Copy link
Member

liZe commented Feb 6, 2022

Thanks for the report, it’s fixed in the 54.x branch.

@liZe liZe added this to the 54.2 milestone Feb 6, 2022
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