I have code in python (Test.py)
import flet
from flet_timer.flet_timer import Timer
def AppScreen(Page):
Page.theme_mode = flet.ThemeMode.LIGHT
Page.window_width = 1100
TimerText = flet.Text(value='0', size=25, color="#28609f")
def TimerPlus():
TimerText.value=int(TimerText.value)+1
Page.update()
Page.add(
flet.Row(
controls=[TimerText, Timer(name="ShiftCount", interval_s=1, callback=TimerPlus)],
alignment=flet.MainAxisAlignment.CENTER
)
)
flet.app(target=AppScreen)
I run flet publish Test.py and then python3 -m http.server –directory dist
When I go to http://localhost:8000 I get error
Unhandled Promise Rejection: PythonError: Traceback (most recent call last):
File "/lib/python311.zip/_pyodide/_base.py", line 571, in eval_code_async
await CodeRunner(
File "/lib/python311.zip/_pyodide/_base.py", line 39...
(anonymous function) - python-worker.js:42
How to fix it?