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

FontConfiguration object has no attribute _folder #2128

Closed
LukasKlement opened this issue Apr 18, 2024 · 2 comments
Closed

FontConfiguration object has no attribute _folder #2128

LukasKlement opened this issue Apr 18, 2024 · 2 comments
Labels
crash Problems preventing documents from being rendered
Milestone

Comments

@LukasKlement
Copy link

With version 61.2 I'm frequently getting this exception:

Exception ignored in: <function FontConfiguration.del at 0x7ff94e0745e0>
Traceback (most recent call last):
File "/home/igeltech/.virtualenvs/renderenv/lib/python3.9/site-packages/weasyprint/text/fonts.py", line 258, in del
rmtree(self._folder, ignore_errors=True)
AttributeError: 'FontConfiguration' object has no attribute '_folder'

I do not know how to reproduce it, it appears randomly.

@liZe liZe added the crash Problems preventing documents from being rendered label Apr 25, 2024
@liZe
Copy link
Member

liZe commented Apr 25, 2024

Thanks for the bug report.

I get this error too when I launch tests. It’s strange:

def __del__(self):
"""Clean a font configuration for a document."""
rmtree(self._folder, ignore_errors=True)

As self._folder is created when the object is initialized, I don’t see how it could not be present…

@liZe liZe added this to the 62.0 milestone Apr 25, 2024
@liZe
Copy link
Member

liZe commented Apr 25, 2024

This bug can happen when a FontConfiguration object is destroyed before its initialization is finished. It can for example happen when tests are launched in parallel: when one test fails, other processes are stopped, maybe at this wrong place.

Your use case is probably different, but the fix should work for you too.

@liZe liZe closed this as completed in 70cafe1 Apr 25, 2024
okkays pushed a commit to okkays/WeasyPrint that referenced this issue May 1, 2024
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