Temporary directory does not get removed
weasyprint apparently creates a temporary directory but does not remove the directory afterwards.
Windows folder location: C:\Users\user.name\AppData\Local\Temp Subfolder naming example: weasyprint-0qjsm58z
The folders are empty but I believe they should be removed to not leave unnecessary folders (I currently have 8000 of these weasyprint-* folders, don't ask 😂).
Hi!
The folders are supposed to be removed here, but:
- It is not guaranteed that
__del__()methods are called for objects that still exist when the interpreter exits (quoting the Python documentation), and - Windows likes to keep references to folders/files even when they’re not used anymore, preventing them to be deleted.
The "real" solution would be to only use data in memory (fonts are not that big). It should be possible to keep config files in memory thanks to FcConfigParseAndLoadFromMemory but there’s nothing to replace FcConfigAppFontAddFile.
If someone finds a better solution, I’ll be happy to try!