flet
flet copied to clipboard
FileNotFoundError: No such file or directory: '[...]/assets'
Description
Installed flet on FreeBSD 14 under virtual environment via poetry, with Python versions 3.9 and 3.11, unable to run the hello world example.
Code example to reproduce the issue:
import flet as ft
def main(page: ft.Page):
page.add(ft.Text(value="Hello, world!"))
ft.app(target=main)
Describe the results you received:
$ python hello.py
Traceback (most recent call last):
File "/home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages/flet_runtime/app.py", line 186, in app_async
fvp, pid_file = await open_flet_view_async(
File "/home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages/flet_runtime/app.py", line 321, in open_flet_view_async
await asyncio.create_subprocess_exec(args[0], *args[1:], env=flet_env),
File "/usr/local/lib/python3.9/asyncio/subprocess.py", line 236, in create_subprocess_exec
transport, protocol = await loop.subprocess_exec(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1676, in subprocess_exec
transport = await self._make_subprocess_transport(
File "/usr/local/lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
transp = _UnixSubprocessTransport(self, protocol, args, shell,
File "/usr/local/lib/python3.9/asyncio/base_subprocess.py", line 36, in __init__
self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
File "/usr/local/lib/python3.9/asyncio/unix_events.py", line 789, in _start
self._proc = subprocess.Popen(
File "/usr/local/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.9/subprocess.py", line 1837, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/src/flet-app/assets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/src/flet-app/hello.py", line 6, in <module>
ft.app(target=main)
File "/home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages/flet_runtime/app.py", line 70, in app
return asyncio.run(
File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages/flet_runtime/app.py", line 207, in app_async
await conn.close()
File "/home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
if self.__receive_loop_task:
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'
Describe the results you expected:
I expected the hello world example to run.
Additional information you deem important (e.g. issue happens only occasionally):
Creating the "assets" directory that Flet is expecting then makes it fail with
PermissionError: [Errno 13] Permission denied: '/home/user/src/flet-app/assets'
Flet version (pip show flet
):
Name: flet
Version: 0.21.1
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: /home/user/.cache/pypoetry/virtualenvs/hello-nq9XZBkn-py3.9/lib/python3.9/site-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by: hello
Give your requirements.txt
file (don't pip freeze
, instead give direct packages):
[tool.poetry.dependencies]
python = "^3.9"
flet = "^0.21.1"
Operating system:
FreeBSD 14.0
Additional environment details:
Using poetry to manage virtual environment.
I'm encountering the same error when running any flet code on my Linux Debian system. I tried it on Windows, and everything works fine.
DeprecationWarning: The python_jwt module is deprecated
import python_jwt as jwt
Traceback (most recent call last):
File "/home/mark/Разработка/Chesu.news/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 199, in app_async
on_app_startup(conn.page_url)
File "/home/mark/Разработка/Chesu.news/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 131, in on_app_startup
print(url_prefix, page_url)
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mark/Разработка/Chesu.news/main.py", line 49, in <module>
ft.app(target=main, assets_dir='assets')
File "/home/mark/Разработка/Chesu.news/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 70, in app
return asyncio.run(
^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/mark/Разработка/Chesu.news/.venv/lib/python3.11/site-packages/flet_runtime/app.py", line 207, in app_async
await conn.close()
File "/home/mark/Разработка/Chesu.news/.venv/lib/python3.11/site-packages/flet_runtime/flet_socket_server.py", line 191, in close
if self.__receive_loop_task:
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FletSocketServer' object has no attribute '_FletSocketServer__receive_loop_task'. Did you mean: '_FletSocketServer__receive_loop'?
^C
Duplicate of https://github.com/flet-dev/flet/issues/2781
The fix for the FletSocketServer
is present only in the latest pre-release for now:
pip install flet --pre
Oh, sorry, forgot to closely look at the first comment with the assets error.
Can you try this @hiway: https://stackoverflow.com/a/76352754