xuancong84 / indicator-cpufreq

for displaying and setting CPU frequency
GNU General Public License v3.0
14 stars 2 forks source link

Bug with GTK import #3

Open RobQuistNL opened 3 months ago

RobQuistNL commented 3 months ago

See https://answers.launchpad.net/ubuntu/+question/327554

indicator-cpufreq.desktop[3450]: /usr/lib/python3/dist-packages/indicator_cpufreq/indicator.py:20: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded.
indicator-cpufreq.desktop[3450]: from gi.repository import Gtk
indicator-cpufreq.desktop[3450]: Traceback (most recent call last):
indicator-cpufreq.desktop[3450]: File "/usr/lib/python3/dist-packages/gi/importer.py", line 142, in load_module
indicator-cpufreq.desktop[3450]: introspection_module = get_introspection_module(namespace)
indicator-cpufreq.desktop[3450]: File "/usr/lib/python3/dist-packages/gi/module.py", line 257, in get_introspection_module
indicator-cpufreq.desktop[3450]: module = IntrospectionModule(namespace, version)
indicator-cpufreq.desktop[3450]: File "/usr/lib/python3/dist-packages/gi/module.py", line 109, in __init__
indicator-cpufreq.desktop[3450]: repository.require(namespace, version)
indicator-cpufreq.desktop[3450]: gi.RepositoryError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded
indicator-cpufreq.desktop[3450]: During handling of the above exception, another exception occurred:
indicator-cpufreq.desktop[3450]: Traceback (most recent call last):
indicator-cpufreq.desktop[3450]: File "/usr/bin/indicator-cpufreq", line 77, in <module>
indicator-cpufreq.desktop[3450]: from indicator_cpufreq.indicator import MyIndicator
indicator-cpufreq.desktop[3450]: File "/usr/lib/python3/dist-packages/indicator_cpufreq/indicator.py", line 21, in <module>
indicator-cpufreq.desktop[3450]: from gi.repository import AppIndicator3 as appindicator
indicator-cpufreq.desktop[3450]: File "/usr/lib/python3/dist-packages/gi/importer.py", line 144, in load_module
indicator-cpufreq.desktop[3450]: raise ImportError(e)
indicator-cpufreq.desktop[3450]: ImportError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded
alexanderankin commented 3 months ago

have you tried following the instructions in the README? i did to no success, going to try reinstalling from ubuntuunity.org next

xuancong84 commented 3 months ago

I did make it work on GTK 3.0 when it came over GTK 2.0 last time round. But now it happens again for going from GTK 3.0 to 4.0. So blame those stupid GTK maintainers for making their stupid 'production' so stupid in legacy compatibility. FYI, I am using my indicator-cpufreq right now everyday because my MX-Linux (Debian Bullseye) is still on GTK 3.0.

alexanderankin commented 3 months ago

Hi Wang, thanks for taking the time to reply- and yes, i will blame gtk based on my experiences as well.

nazar-pc commented 2 months ago

https://github.com/xuancong84/indicator-cpufreq/commit/315af22216cc0ed19c586e20c2e6120c2efc1333 fixes it, I had the same issue with version from Ubuntu 22.04 repos and I just patched it accordingly

xuancong84 commented 2 months ago

Thanks, @nazar-pc for the patch. Strangely speaking, even without patching, it works out right away on my Ubuntu 22.04 with KDE plasma desktop environment. Maybe Gnome uses a higher version GTK?

nazar-pc commented 2 months ago

I'm using a custom DE, but with Gnome components and I do have GTK4 installed. Not sure if that is the default though, I did some development with GTK4 and might have installed something that would not be shipped out of the box, but since those can be pulled by some dependencies, I'd expect many users to be affected.

P.S. I should thank you, that is the latest commit in this repo :slightly_smiling_face: