Frog icon indicating copy to clipboard operation
Frog copied to clipboard

“Failed to decode data” error

Open xplosionmind opened this issue 1 year ago • 6 comments

Using Frog 1.5.1 installed from Flatpak on Fedora 40 using GNOME and Wayland.

Logs

flatpak run com.github.tenderowl.frog 

** (python:2): WARNING **: 13:09:18.058: expected enumeration type void, but got PyGLibOptionArg instead
2024-06-26 13:09:18.063 | DEBUG    | frog.widgets.language_popover:__init__:69 - active-language
2024-06-26 13:09:18.086 | DEBUG    | frog.language_manager:active_language:208 - Active language set to <LanguageItem: Italian, ita>
/app/lib/python3.11/site-packages/frog/window.py:84: Warning: g_variant_type_checked_: assertion 'g_variant_type_string_is_valid (type_string)' failed
  self.install_action("window.share", "provider", self._on_share)
/app/lib/python3.11/site-packages/frog/window.py:84: Warning: g_variant_type_copy: assertion 'g_variant_type_check (type)' failed
  self.install_action("window.share", "provider", self._on_share)
2024-06-26 13:09:21.618 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed
2024-06-26 13:09:21.628 | DEBUG    | frog.services.screenshot_service:decode_image:117 - Decoding with ita+eng language.
2024-06-26 13:09:21.666 | DEBUG    | frog.services.screenshot_service:decode_image:140 - ERROR: 

xplosionmind avatar Jun 26 '24 11:06 xplosionmind

Exact same issue, for english, when selecting from an area. Same output. Same system (albeit, Silverblue)

teamcons avatar Jul 13 '24 22:07 teamcons

I too encountered this issue; Frog 1.5.1, GNOME 47 on Wayland, Arch. In services/screenshot_service.py, at the beginning of decode_image I added:

# replace %xx escapes with their single-character equivalent 
if isinstance(file, str):
    from urllib.parse import urlparse, unquote
    file = unquote(urlparse(file).path)

...and with that the issue disappeared.

Apparently decode_image receives a path with '%xx escapes', and apparently Image.open fails to interpret these.

pthr avatar Sep 17 '24 12:09 pthr

I too encountered this issue; Frog 1.5.1, GNOME 47 on Wayland, Arch. In services/screenshot_service.py, at the beginning of decode_image I added:

# replace %xx escapes with their single-character equivalent 
if isinstance(file, str):
    from urllib.parse import urlparse, unquote
    file = unquote(urlparse(file).path)

...and with that the issue disappeared.

Apparently decode_image receives a path with '%xx escapes', and apparently Image.open fails to interpret these.

This was fixed in Frog 1.5.2, released 3 weeks ago. Make sure to update your apps!

This issue (and #98) should be closed @amka

DaPigGuy avatar Sep 20 '24 22:09 DaPigGuy

I am using v1.5.2, and I am still getting the same error:

flatpak run com.github.tenderowl.frog 

** (python:2): WARNING **: 10:38:37.824: expected enumeration type void, but got PyGLibOptionArg instead
2024-09-28 10:38:37.832 | DEBUG    | frog.widgets.language_popover:__init__:69 - active-language
2024-09-28 10:38:37.867 | DEBUG    | frog.language_manager:active_language:208 - Active language set to <LanguageItem: Italian, ita>
/app/lib/python3.11/site-packages/frog/window.py:84: Warning: g_variant_type_checked_: assertion 'g_variant_type_string_is_valid (type_string)' failed
  self.install_action("window.share", "provider", self._on_share)
/app/lib/python3.11/site-packages/frog/window.py:84: Warning: g_variant_type_copy: assertion 'g_variant_type_check (type)' failed
  self.install_action("window.share", "provider", self._on_share)
2024-09-28 10:38:41.757 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed
2024-09-28 10:38:41.768 | DEBUG    | frog.services.screenshot_service:decode_image:118 - Decoding with ita+eng language.
2024-09-28 10:38:41.847 | DEBUG    | frog.services.screenshot_service:decode_image:141 - ERROR: 
2024-09-28 10:38:50.565 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed
2024-09-28 10:38:50.576 | DEBUG    | frog.services.screenshot_service:decode_image:118 - Decoding with ita+eng language.
2024-09-28 10:38:50.889 | DEBUG    | frog.services.screenshot_service:decode_image:141 - ERROR: 
2024-09-28 10:38:54.353 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed
2024-09-28 10:38:54.363 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed

xplosionmind avatar Sep 28 '24 07:09 xplosionmind

@xplosionmind Unfortunately, Frog is not correctly logging the error, and the warning above is unrelated. I am also unable to reproduce the issue on Fedora 41/GNOME/Wayland + Flatpak. Could you clone the repo, apply two simple changes, & then run it so we could get actual info on what's wrong?

  1. Replace line 141 of frog/services/screenshot_service.py with logging.exception("ERROR") which will produce a stacktace
  2. Add an import logging

I would recommend using GNOME Builder which will make editing & running very easy.

DaPigGuy avatar Sep 28 '24 23:09 DaPigGuy

Sorry for the late reply, @DaPigGuy!

I followed the steps that you told me, and unfortunately I can’t reproduce the bug either… It works with all the three options to get an image to extract text from! Maybe the log could shine some light on the matter:

Application started at 01:06:27 PM
2024-11-19 13:06:28.517 | INFO     | frog.main:ensure_installation_id:136 - No installation id was found. Generating a new one.

** (python:2): WARNING **: 13:06:28.551: expected enumeration type void, but got PyGLibOptionArg instead
2024-11-19 13:06:28.555 | DEBUG    | frog.widgets.language_popover:__init__:69 - active-language
2024-11-19 13:06:28.573 | DEBUG    | frog.language_manager:active_language:208 - Active language set to <LanguageItem: English, eng>
/app/lib/python3.12/site-packages/frog/window.py:84: Warning: g_variant_type_checked_: assertion 'g_variant_type_string_is_valid (type_string)' failed
  self.install_action("window.share", "provider", self._on_share)
/app/lib/python3.12/site-packages/frog/window.py:84: Warning: g_variant_type_copy: assertion 'g_variant_type_check (type)' failed
  self.install_action("window.share", "provider", self._on_share)
2024-11-19 13:06:52.550 | DEBUG    | frog.main:on_settings_changed:145 - SETTINGS: %s changed
2024-11-19 13:06:59.973 | DEBUG    | frog.services.screenshot_service:decode_image:119 - Decoding with eng+eng language.
2024-11-19 13:07:00.289 | DEBUG    | frog.services.screenshot_service:decode_image:148 - Removing /run/user/1000/doc/b354d02a/Screenshot From 2024-11-19 13-06-59.png
2024-11-19 13:07:00.290 | DEBUG    | frog.services.screenshot_service:decode_image:151 - Error deleting /run/user/1000/doc/b354d02a/Screenshot From 2024-11-19 13-06-59.png: [Errno 13] Permission denied: '/run/user/1000/doc/b354d02a/Screenshot From 2024-11-19 13-06-59.png'
2024-11-19 13:07:00.290 | DEBUG    | frog.services.screenshot_service:decode_image:154 - Extracted successfully

xplosionmind avatar Nov 19 '24 11:11 xplosionmind