Why does lottie give the error ImportError: cannot import name 'PngRenderer' from 'lottie.exporters.cairo'?
import lottie
from lottie.exporters.gif import export_gif
from lottie.parsers.tgs import parse_tgs
def convert_tgs_to_gif(tgs_file, gif_file):
try:
animation = parse_tgs(tgs_file)
export_gif(animation, gif_file, skip_frames=5, dpi=48)
return True
except Exception:
logging.exception("Error occurred while converting TGS to GIF.")
return False
Traceback errors:
Traceback (most recent call last):
File "C:\Users\Bubunduc\PycharmProjects\tg\main.py", line 11, in <module>
from lottie.exporters.gif import export_gif
File "C:\Users\Bubunduc\PycharmProjects\tg\venv\lib\site-packages\lottie\exporters\gif.py", line 5, in <module>
from .cairo import PngRenderer
ImportError: cannot import name 'PngRenderer' from 'lottie.exporters.cairo' (C:\Users\Bubunduc\PycharmProjects\tg\venv\lib\site-packages\lottie\exporters\cairo.py)
I tried to import this library in different ways, tried to understand the source code