I have a code like this which works fine when running directly:
def on_button_clicked(button):
button.filedialog.open(callback=on_filedialog_response)
def on_filedialog_response(filedialog, task):
try:
file = filedialog.open_finish(task)
except GLib.GError:
# gtk-dialog-error-quark: Dismissed by user
pass
else:
print(file.get_uri())
data = file.read()
print(data)
But when I run it in flatpak, I can’t access the file. The output is:
file:///run/user/1000/doc/19c44102/gvimrc
Traceback (most recent call last):
File "/app/lib/python3.11/site-packages/carburetor/handler.py", line 300, in on_filedialog_response
data = file.read()
^^^^^^^^^^^
gi.repository.GLib.GError: g-io-error-quark: Error opening file /run/user/1000/doc/19c44102/gvimrc: No such file or directory (1)