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

FilePicker crash the flet.app() after open directory dialog and choose one directory #1572

Closed
tianzry opened this issue Jul 9, 2023 · 11 comments

Comments

@tianzry
Copy link

tianzry commented Jul 9, 2023

Description

FilePicker crash the flet.app() after open directory dialog and choose one directory

Code example to reproduce the issue:

the code is from project's example: code url

import flet
from flet import (
    ElevatedButton,
    FilePicker,
    FilePickerResultEvent,
    Page,
    Row,
    Text,
    icons,
)


def main(page: Page):
    # Pick files dialog
    def pick_files_result(e: FilePickerResultEvent):
        selected_files.value = (
            ", ".join(map(lambda f: f.name, e.files)) if e.files else "Cancelled!"
        )
        selected_files.update()

    pick_files_dialog = FilePicker(on_result=pick_files_result)
    selected_files = Text()

    # Save file dialog
    def save_file_result(e: FilePickerResultEvent):
        save_file_path.value = e.path if e.path else "Cancelled!"
        save_file_path.update()

    save_file_dialog = FilePicker(on_result=save_file_result)
    save_file_path = Text()

    # Open directory dialog
    def get_directory_result(e: FilePickerResultEvent):
        directory_path.value = e.path if e.path else "Cancelled!"
        directory_path.update()

    get_directory_dialog = FilePicker(on_result=get_directory_result)
    directory_path = Text()

    # hide all dialogs in overlay
    page.overlay.extend([pick_files_dialog, save_file_dialog, get_directory_dialog])

    page.add(
        Row(
            [
                ElevatedButton(
                    "Pick files",
                    icon=icons.UPLOAD_FILE,
                    on_click=lambda _: pick_files_dialog.pick_files(
                        allow_multiple=True
                    ),
                ),
                selected_files,
            ]
        ),
        Row(
            [
                ElevatedButton(
                    "Save file",
                    icon=icons.SAVE,
                    on_click=lambda _: save_file_dialog.save_file(),
                    disabled=page.web,
                ),
                save_file_path,
            ]
        ),
        Row(
            [
                ElevatedButton(
                    "Open directory",
                    icon=icons.FOLDER_OPEN,
                    on_click=lambda _: get_directory_dialog.get_directory_path(),
                    disabled=page.web,
                ),
                directory_path,
            ]
        ),
    )


flet.app(target=main)

Describe the results you received:

When I click the "Open directory" button, choose a directory and click OK, it would return to the main gui window, but wait for few seconds, the app crash, here is the sreen recording:

bandicam.2023-07-09.19-58-18-966.mp4

Describe the results you expected:
After choose the directory, the app shouldn't crash.

Additional information you deem important (e.g. issue happens only occasionally):

Flet version (pip show flet):

Name: flet
Version: 0.8.1
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page:
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0

Operating system:
Windows 10

Additional environment details:

@tianzry
Copy link
Author

tianzry commented Jul 9, 2023

I roll back to flet==0.7.4, and it work OK.

@03Jesus
Copy link

03Jesus commented Jul 12, 2023

I got the same error. Like you, rolling back to a previous version it works. I hope it will be fixed in a future update

@yyqdata
Copy link

yyqdata commented Jul 13, 2023

I got the same error. Like you, rolling back to a previous version it works.

@FeodorFitsner
Copy link
Contributor

That might be a bug in file_picker package: miguelpruivo/flutter_file_picker#1317

will take a look.

@hokaso
Copy link
Contributor

hokaso commented Jul 20, 2023

#1563 #1562 same issue

@hokaso
Copy link
Contributor

hokaso commented Jul 20, 2023

miguelpruivo/flutter_file_picker#1317 (comment)

Since fallback to version 5.3.1 is valid, why don't the next flet version fallback to file_picker version first?

file_picker: ^5.3.0

file_picker: ^5.3.0 → file_picker: 5.3.1
Temporarily locked version
@FeodorFitsner

slashfast added a commit to slashfast/CoatOfArmsFitter that referenced this issue Jul 20, 2023
Refactoring: move part of pick_files_result behavior to accept_dlg
@hokaso
Copy link
Contributor

hokaso commented Jul 23, 2023

My usage scenario is very special. The flet upgrade from 0.7.4 to 0.8.2 reconstructs a lot of authentication code. I have made my project compatible with the latest version, and it is impossible for them to go back to the old version... So I can only wait for the flet to upgrade to the new version, this is the only way.

@hokaso
Copy link
Contributor

hokaso commented Jul 24, 2023

This problem has too great an impact. I really hope you can return the version soon. If this continues, all our users will be lost... @FeodorFitsner

@FeodorFitsner
Copy link
Contributor

Sorry for the hassle!

I've rolled back file_picker dependency to 5.2.5 and you can try it be installing this Flet pre-release: https://pypi.org/project/flet/0.9.0.dev1620/

Let me know if that worked.

@hokaso
Copy link
Contributor

hokaso commented Jul 24, 2023

Sorry for the hassle!

I've rolled back file_picker dependency to 5.2.5 and you can try it be installing this Flet pre-release: https://pypi.org/project/flet/0.9.0.dev1620/

Let me know if that worked.

Thanks for your attention to this issue and understanding our urgency! I just tested that there is no crash problem, but we are still one step away from the release (https://github.com/flet-dev/flet/releases) You need to release the relevant binaries in releases, and users can complete the complete update.

@FeodorFitsner
Copy link
Contributor

Published as https://pypi.org/project/flet/0.8.4/

zrr1999 pushed a commit to zrr1999/flet that referenced this issue Jul 17, 2024
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

5 participants