-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
Getting a "connection lost" error when trying to use the file picker in native mode #1430
Comments
The posted code is working for me. Maybe its an operating system issue? I'm on Mac OS with Chrome. |
Interesting. I'm on RHEL 9 and using GTK for Webview. I found QT did not work (I was getting a white blank screen). I am able to launch the file browser using Webview, e.g. import webview
def open_file_dialog(window):
file_types = ('Image Files (*.bmp;*.jpg;*.gif)', 'All files (*.*)')
result = window.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=True, file_types=file_types)
print(result)
if __name__ == '__main__':
window = webview.create_window('Open file dialog example', 'https://pywebview.flowrl.com/hello')
webview.start(open_file_dialog, window)
so I guess it's not an issue with Webview? |
I turned on uvicorn_debug and got
when I clicked on the "open file" dialog. I guess it's not able to get a connection to something since there's no reply? |
It may be some code is blocking the main thread. Can anyone on Linux with GTK confirm this issue? |
@NiklasNeugebauer, @JensOgorek, I already tried to reproduce this issue with @denniswittich, but we couldn't get GTK running. Could one of you, please, try to run the code from the original post and see if the file dialog works? Thanks! |
I can confirm the error. Tried the code above, clicked on "Choose File" and connection is lost. |
to add some info, for me it works fine if I am in debug mode (pytorch) but i get the same issue when i am in run mode. |
I just reproduced the issue on an Ubuntu machine, but I have no clue why the dialog doesn't open. I thought it might have to do with the button click, but this minimal pywebview example works perfectly fine: import webview
class Api:
def open_file_dialog(self):
print(window.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=True, file_types=()))
api = Api()
window = webview.create_window('Test', html='<button onclick="pywebview.api.open_file_dialog()">open dialog</button>', js_api=api)
webview.start() Are we doing something wrong when sending the request to the other process? nicegui/nicegui/native/native.py Lines 114 to 123 in 460dbc1
Should we set |
@falkoschindler I changed the code of native.py, but it seems it already get stuck at |
I am trying nicegui and native=True, but things are not working for me. If I try the code at the top from the OP: from nicegui import app, ui
async def choose_file():
files = await app.native.main_window.create_file_dialog(allow_multiple=True)
for file in files:
ui.notify(file)
ui.button('choose file', on_click=choose_file)
ui.run(native=True) The final error message is as follows:
I am in Rocky9 and using a conda environment that I created (in the last 48 hours) with the latest nicegui |
pywebview 5.3 just got released. Can anyone check if the problem persists? |
Description
I'm trying to use the example case provided in #283
but when I try to run this, I get a message "Connection lost", and the file browser doesn't show up.
The text was updated successfully, but these errors were encountered: