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

App startup fails #714

Closed
clobrano opened this issue Jan 19, 2023 · 5 comments · Fixed by #715
Closed

App startup fails #714

clobrano opened this issue Jan 19, 2023 · 5 comments · Fixed by #715

Comments

@clobrano
Copy link

clobrano commented Jan 19, 2023

On Fedora 36, using wayland, launching Hamster from the Application list (or Dock, once pinned), does not work.

journalctl log shows this error

g_app_launch_context_launch_failed: assertion 'startup_notify_id != NULL' failed

Hamster installed via Flatpak, v3.0.2

@clobrano
Copy link
Author

It seemed different that #713, so I opened a new bug, feel free to close it if is the same problem.

@clobrano
Copy link
Author

clobrano commented Feb 3, 2023

I just notice that it crashes only on Gnome (in Fedora 36), while un KDE it works just fine.
Let me know if I can help with more info

EDIT: I will take this back. Today I got the same error on KDE too. Yesterday worked fine because I lunched it from Discover 🤷

@fgrosse
Copy link
Contributor

fgrosse commented Mar 21, 2023

I have the same issue on Fedora 37, using wayland and Gnome. When I try to start the hamster GUI nothing happens and I see the following in the logs:

Mär 21 08:12:27 argo python3[15744]: detected unhandled Python exception in '/usr/bin/hamster'
Mär 21 08:12:27 argo hamster[15744]: Traceback (most recent call last):
Mär 21 08:12:27 argo hamster[15744]:   File "/usr/bin/hamster", line 415, in <module>
Mär 21 08:12:27 argo hamster[15744]:     i18n.setup_i18n()
Mär 21 08:12:27 argo hamster[15744]:   File "/usr/lib/python3.11/site-packages/hamster/lib/i18n.py", line 24, in setup_i18n
Mär 21 08:12:27 argo hamster[15744]:     module.bind_textdomain_codeset('hamster','utf8')
Mär 21 08:12:27 argo hamster[15744]:     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mär 21 08:12:27 argo hamster[15744]: AttributeError: module 'gettext' has no attribute 'bind_textdomain_codeset'
Mär 21 08:12:27 argo abrt-server[15751]: Executable '/usr/bin/hamster' doesn't belong to any package and ProcessUnpackaged is set to 'no'
Mär 21 08:12:27 argo abrt-server[15751]: 'post-create' on '/var/spool/abrt/Python3-2023-03-21-08:12:27-15744' exited with 1
Mär 21 08:12:27 argo abrt-server[15751]: Deleting problem directory '/var/spool/abrt/Python3-2023-03-21-08:12:27-15744'
Mär 21 08:12:27 argo systemd[3633]: dbus-:[email protected]: Main process exited, code=exited, status=1/FAILURE
Mär 21 08:12:27 argo systemd[3633]: dbus-:[email protected]: Failed with result 'exit-code'.
Mär 21 08:12:27 argo gnome-shell[3790]: g_app_launch_context_launch_failed: assertion 'startup_notify_id != NULL' failed

I installed hamster from source using the master branch at 71076a5.

@fgrosse
Copy link
Contributor

fgrosse commented Mar 21, 2023

A simple way to reproduce the issue is by executing hamster (or hamster-service) directly on the CLI:

$ hamster        
Traceback (most recent call last):
  File "/usr/bin/hamster", line 415, in <module>
    i18n.setup_i18n()
  File "/usr/lib/python3.11/site-packages/hamster/lib/i18n.py", line 24, in setup_i18n
    module.bind_textdomain_codeset('hamster','utf8')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'gettext' has no attribute 'bind_textdomain_codeset'

Even though I'm no Python expert, I suspect this to be a Python 3.11 issue. I found the following line in the Python 3.11 changelog:

Removed the deprecated gettext functions lgettext(), ldgettext(), lngettext() and ldngettext(). Also removed the bind_textdomain_codeset() function, the NullTranslations.output_charset() and NullTranslations.set_output_charset() methods, and the codeset parameter of translation() and install(), since they are only used for the l*gettext() functions. (Contributed by Dong-hee Na and Serhiy Storchaka in bpo-44235.)

When I remove the offending bind_textdomain_codeset function call and reinstall hamster it seems to work as expected 🎉 .

diff --git a/src/hamster/lib/i18n.py b/src/hamster/lib/i18n.py
index 7bb89773..08488862 100644
--- a/src/hamster/lib/i18n.py
+++ b/src/hamster/lib/i18n.py
@@ -21,8 +21,6 @@ def setup_i18n():
             module.bindtextdomain('hamster', locale_dir)
             module.textdomain('hamster')
 
-            module.bind_textdomain_codeset('hamster','utf8')
-
         gettext.install("hamster", locale_dir)
 
     else:

@clobrano
Copy link
Author

The above is surely necessary, however installing from source (master HEAD) does not incurr into this issue anyway

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

Successfully merging a pull request may close this issue.

2 participants