I think the installation of weasyprint was successful, but this will be a problem.What can be considered as the cause?
from bs4 import BeautifulSoup
from weasyprint import HTML, CSS, default_url_fetcher
from weasyprint.fonts import FontConfiguration
from os import listdir
import sys
import shutil
import zipfile
importos
from inspect import currentframe, getframeinfo
import logging
It seems to have been resolved by pointing out the comments, so I will answer them.
The content written in the issue below will be true.
ModuleNotFoundError: No module named 'weasyprint.fonts'#1419
Had a similar issue.Apparently the import path has changed.This works for me:
from weasyprint.text.fonts import FontConfiguration# for weasyprint53
# from weasyprint.fonts import FontConfiguration# for weasyprint52
In other words, after v53 of weasyprint
, .text
must be inserted between from weasyprint.fontConfiguration
instead of from weasyprint.fontConfiguration
.
© 2024 OneMinuteCode. All rights reserved.