Issue with flet-pyodide in versions 0.25.0 and 0.25.1 when using local HTTP server #4466
-
QuestionHello. I have a fairly large project that heavily relies on the functionality of flet-pyodide. Up until version 0.25.0, my program was working perfectly. To test my project, I use the following command: This command gives me a better understanding of how my site will work in reality compared to the command This issue occurs in versions 0.25.0 and 0.25.1. I’m also unsure what code I should provide since this issue doesn’t seem to be related to how I write my code.
Can anyone help with this? This is very important to me. Code sampleNo response Error messagePythonError: Traceback (most recent call last):
File "/lib/Python311.zip/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1209, in _gcd_import
File "<frozen importlib._bootstrap>", line 1181, in _find_and_load
File "<frozen importlib._bootstrap>", line 1152, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pyodide/main.py", line 1, in <module>
import flet as ft
ModuleNotFoundError: No module named 'flet' ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
Beta Was this translation helpful? Give feedback.
-
Who is able to reproduce this issue? |
Beta Was this translation helpful? Give feedback.
-
Hello, @ndonkoHenri. I was wondering if I could improve my question about this issue. I really don’t understand what I’m doing wrong when installing the new version of Flet. How can I make my question better? I also noticed that on PyPI, there’s only a pre-release version of |
Beta Was this translation helpful? Give feedback.
-
I read it again very carefully. Please explain it to me like I'm a beginner, just one moment. I thought it would be easier to show with examples. To reproduce the problem I am talking about, you can use the code from the documentation. Look, here is the code from the documentation: import flet as ft
def main(page: ft.Page):
page.title = "Flet counter example"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
txt_number = ft.TextField(value="0", text_align=ft.TextAlign.RIGHT, width=100)
def minus_click(e):
txt_number.value = str(int(txt_number.value) - 1)
page.update()
def plus_click(e):
txt_number.value = str(int(txt_number.value) + 1)
page.update()
page.add(
ft.Row(
[
ft.IconButton(ft.Icons.REMOVE, on_click=minus_click),
txt_number,
ft.IconButton(ft.Icons.ADD, on_click=plus_click),
],
alignment=ft.MainAxisAlignment.CENTER,
)
)
#flet publish main.py --assets assets --app-name MyApp --app-description "My Static Site"
#python -m http.server 8080 --bind 127.0.0.1 --directory dist
ft.app(main) In version 0.24.1, I ran this app with the following commands: flet publish main.py --assets assets --app-name MyApp --app-description "My Static Site" python -m http.server 8080 --bind 127.0.0.1 --directory dist A static site opened up, and it worked completely in the browser along with Pyodide. Now, in version 0.25.0 and 0.25.1, I use the same commands, but I get the error I mentioned at the top. I suspect that I'm just banging my head against a wall. The point is, I'm running my other project using the built-in Python tool. Now this doesn't work. video example: - The result I want and get in version 0.24.1 12-04_23-31-15.mp4- The result that does not satisfy me in version 0.25.1 12-04_23-37-06.mp4 |
Beta Was this translation helpful? Give feedback.
Add
requirements.txt
with this:Re-publish the app. Let me know if that worked.