1

I'm trying to run a python flet script on repl.it. Here's what I did:

  1. created a new repl, for a python script; repl.it creates a main.py file
  2. from the Packages tool I imported flet
  3. I wrote this code into main.py:
import flet as ft

def main(page:ft.Page):
  page.add(ft.Text("Hello World"))
  page.update()


ft.app(target=main)

And I clicked the Run button. I got this error:

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    ft.app(target=main)
  File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 102, in app
    conn = _connect_internal(
  File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 192, in _connect_internal
    port = _start_flet_server(
  File "/home/runner/test/venv/lib/python3.10/site-packages/flet/flet.py", line 361, in _start_flet_server
    subprocess.Popen(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 1847, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/runner/test/venv/lib/python3.10/site-packages/flet/bin/fletd'

I've gotten this same Permission denied error with every flet script I've tried. (Non flet scripts don't have errors.)

Al C
  • 5,175
  • 6
  • 44
  • 74

1 Answers1

1

In your repl.it shell, you need to run this command first:

chmod +wrx venv/lib/python3.*/site-packages/flet/bin/fletd

I've recently created a small template that does this through subprocess.run on init before the flet app is bootstrapped, that you can fork and use here

Verv
  • 2,385
  • 2
  • 23
  • 37