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

Ubuntu 22.04 fakexrandr-manage crashes: 'gi.repository.Gtk' object has no attribute 'HBox' #72

Open
p0pit0 opened this issue Aug 18, 2022 · 3 comments

Comments

@p0pit0
Copy link

p0pit0 commented Aug 18, 2022

Ubuntu 22.04 fakexrandr-manage crashes

fakexrandr-manage
/usr/bin/fakexrandr-manage:27: 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.
from gi.repository import Gtk, Gdk
Traceback (most recent call last):
File "/usr/bin/fakexrandr-manage", line 318, in
class ConfigurationWidget(Gtk.HBox):
File "/usr/lib/python3/dist-packages/gi/overrides/init.py", line 32, in getattr
return getattr(self._introspection_module, name)
File "/usr/lib/python3/dist-packages/gi/module.py", line 123, in getattr
raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gtk' object has no attribute 'HBox'

@BrutPitt
Copy link

BrutPitt commented Sep 5, 2022

Same identical issue with Fedora 36 (Mate/Marco windows manager)

fakexrandr-manage 
/usr/bin/fakexrandr-manage:37: 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.
  from gi.repository import Gtk, Gdk
Traceback (most recent call last):
  File "/usr/bin/fakexrandr-manage", line 328, in <module>
    class ConfigurationWidget(Gtk.HBox):
  File "/usr/lib/python3.10/site-packages/gi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib64/python3.10/site-packages/gi/module.py", line 126, in __getattr__
    raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gtk' object has no attribute 'HBox'

@phillipberndt
Copy link
Owner

Does adding import gi; gi.require_version('Gtk', '3.0') to the top of the script, straight before the first other Import, suffice to fix this?

@BrutPitt
Copy link

BrutPitt commented Sep 5, 2022

Thanks for the fast reply.

Yes, It works for me.
Adding import gi; gi.require_version('Gtk', '3.0'), just after from __future__ import print_function, in fakexrandr-manage script

Thanks again.

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

No branches or pull requests

3 participants