Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main.exe runs with "Unhandled exception in script" #4538

Closed
1 task done
Vlad19Cher opened this issue Dec 10, 2024 · 4 comments
Closed
1 task done

main.exe runs with "Unhandled exception in script" #4538

Vlad19Cher opened this issue Dec 10, 2024 · 4 comments
Assignees

Comments

@Vlad19Cher
Copy link

Duplicate Check

Describe the bug

I've packed the main.py to main.exe in Windows10

flet pack main.py

when it runs it crashes with Unhandled exception in script

Traceback (most recent call last):
File "test.py", line 7, in
File "flet\app.py", line 64, in app
File "asyncio\runners.py", line 194, in run
File "asyncio\runners.py", line 118, in run
File "asyncio\base_events.py", line 687, in run_until_complete
File "flet\app.py", line 189, in app_async
File "flet_desktop_init_.py", line 39, in open_flet_view_async
File "flet_desktop_init_.py", line 87, in _locate_and_unpack_flet_view
File "flet_desktop_init
.py", line 177, in __download_flet_client
File "urllib\request.py", line 240, in urlretrieve
File "urllib\request.py", line 215, in urlopen
File "urllib\request.py", line 521, in open
File "urllib\request.py", line 630, in http_response
File "urllib\request.py", line 559, in error
File "urllib\request.py", line 492, in _call_chain
File "urllib\request.py", line 639, in http_error_default
urllib.error.HTTPError: HTTP Error 404: Not Found

I thought it was my fault, but this peace of code won't start either.

import flet as ft

def main(page: ft.Page):
page.title = "Hello Flet"
page.add(ft.Text("Hello, World!"))

ft.app(target=main)

It works fine in VS Code, my main.py works fine in VS Code but exe-file not work at all

Why

Code sample

Code
import flet as ft

def main(page: ft.Page):
    page.title = "Hello Flet"
    page.add(ft.Text("Hello, World!"))

ft.app(target=main)

To reproduce

import flet
import pyinstaller

pack this code

import flet as ft

def main(page: ft.Page):
    page.title = "Hello Flet"
    page.add(ft.Text("Hello, World!"))

ft.app(target=main)

to an exe file

flet pack main.py

try to run it

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

![flet-error](https://github.com/user-attachments/assets/56404869-7b36-43e5-9084-33ea40d3955f)

Operating System

Windows

Operating system details

windows 10

Flet version

0.25.1

Regression

No, it isn't

Suggestions

A asked chtGPT. He doesn't know )

Logs

Logs
[Paste your logs here]

Additional details

No response

@FeodorFitsner FeodorFitsner self-assigned this Dec 10, 2024
@Vlad19Cher
Copy link
Author

It works perfectly now. Thank you!
It seems that it started working as soon as the flet-windows.zip appeared in the repository

@NaotoTakata
Copy link

How did you solve the problem?
I'm still stuck.

@Vlad19Cher
Copy link
Author

Specifically, it didn’t work for me because when running the .exe, the program was trying to find and download the flet-windows.zip file in the repository at https://github.com/flet-dev/flet/releases. I find such a developer's decision to be quite controversial. Since it wasn’t available, an error occurred. And it wasn’t just me experiencing this issue, judging by the list of open issues. As soon as flet-windows.zip appeared in the repository, everything started working fine.

Additionally, you can completely uninstall Flet and reinstall it, or install it in a virtual environment (venv).

pip install --no-cache-dir flet[all]

@FeodorFitsner
Copy link
Contributor

I find such a developer's decision to be quite controversial.

This is regression which is going to be fixed: #4549

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants