-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
Problem with Lottie animation
I am encountering an Unknown control: lottie error when trying to use the Lottie control in my Flet application, even though the flet-lottie package is installed in my environment.
Environment:
- Flet Version: >=0.27.6
- flet-lottie Version: 0.1.0
- Operating System: Windows
- Python Version: 3.13.3
ft.Lottie(
src="assets/earth.json", # Use the path directly
animate=True,
repeat=True,
width=200,
height=200,
)
but every time getting error : Unknown control: lottie
I also try different approach ..
import flet as ft
from flet_lottie import Lottie
import base64
import os
# Assume assets/satellite-earth-orbiting.json exists and is valid
LOTTIE_JSON_PATH = "assets/satellite-earth-orbiting.json"
def main(page: ft.Page):
page.title = "Lottie Test"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
json_base64 = None
try:
# Adjust path finding if necessary for the minimal example
script_dir = os.path.dirname(os.path.abspath(__file__))
absolute_path = os.path.normpath(os.path.join(script_dir, LOTTIE_JSON_PATH))
with open(absolute_path, "r", encoding="utf-8") as f:
json_data = f.read()
json_base64 = base64.b64encode(json_data.encode('utf-8')).decode('utf-8')
except Exception as e:
print(f"Error loading Lottie JSON: {e}")
# Add a text control showing the error if loading fails
page.add(ft.Text(f"Error loading Lottie JSON: {e}"))
return # Stop if loading failed
if json_base64:
lottie_control = Lottie(
src_base64=json_base64,
animate=True,
repeat=True,
width=200,
height=200,
)
page.add(lottie_control)
else:
page.add(ft.Text("Lottie JSON could not be loaded."))
page.update()
if __name__ == "__main__":
ft.app(target=main, assets_dir="assets")
Still getting same ERROR: Unknown control: lottie
Code sample
Code
ft.Lottie(
src="assets/earth.json", # Use the path directly
animate=True,
repeat=True,
width=200,
height=200,
)
To reproduce
- Set up a Python environment with flet>=0.27.6 and flet-lottie==0.1.0 .
- Create a simple Flet app using the Lottie control as shown above (using either src or src_base64 ).
- Ensure a valid Lottie JSON file exists at the specified path.
- Run the Flet application ( python main.py ).
Expected behavior
The Lottie animation should be displayed in the Flet window without errors.
Actual Behavior:
The application fails with the error message: Exception: Unknown control: lottie (or similar traceback indicating the control is not recognized).
Troubleshooting Steps Taken:
- Confirmed flet-lottie is installed in the correct Python environment using pip list or uv pip list .
- Tried reinstalling dependencies ( pip install -r requirements.txt --force-reinstall or uv sync --reinstall ).
- Verified the Python interpreter used by the IDE/terminal matches the environment where packages are installed.
- Restarted the IDE.
- Tried loading the Lottie file using both src (relative path) and src_base64 .
Screenshots / Videos
Captures
[Upload media here]
Operating System
Windows
Operating system details
Windows 11
Flet version
0.27.6
Regression
No, it isn't
Suggestions
Please fix this issue
Logs
Logs
[Paste your logs here]
Additional details
No response
Kakarotto22 and NiTRoeSE
Metadata
Metadata
Assignees
Labels
No labels