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

ImportError: Gtk3 requires X11, and no DISPLAY environment variable is set #9904

Closed
twisted-trac opened this issue Jul 14, 2020 · 6 comments
Closed

Comments

@twisted-trac
Copy link

muelli's avatar @muelli reported
Trac ID trac#9904
Type enhancement
Created 2020-07-14 11:56:27Z
Traceback (most recent call last):
  File "/app/bin/gnome-keysign", line 10, in <module>
    sys.exit(main())
  File "/app/lib/python3.7/site-packages/keysign/__init__.py", line 22, in main
    from . import app
  File "/app/lib/python3.7/site-packages/keysign/app.py", line 31, in <module>
    from twisted.internet import gtk3reactor
  File "/app/lib/python3.7/site-packages/twisted/internet/gtk3reactor.py", line 38, in <module>
    "Gtk3 requires X11, and no DISPLAY environment variable is set")
ImportError: Gtk3 requires X11, and no DISPLAY environment variable is set

This seems to be hard coded

if (runtime.platform.getType() == 'posix' and
not runtime.platform.isMacOSX() and not os.environ.get("DISPLAY")):
raise ImportError(
"Gtk3 requires X11, and no DISPLAY environment variable is set")

clearly, people run wayland sessions.

flathub/org.gnome.Keysign#14

Searchable metadata
trac-id__9904 9904
type__enhancement enhancement
reporter__muelli muelli
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1594727787212418 1594727787212418
changetime__1599881875740526 1599881875740526
version__None None
owner__Tom_Most__twm_____ Tom Most <twm@...>

@twisted-trac
Copy link
Author

muelli's avatar @muelli commented

I have just found this bug which introduced the check: #6170

@twisted-trac
Copy link
Author

muelli's avatar @muelli commented

I have experimented a little bit.

My setup is a freshly installed Ubuntu 20.04 with a Wayland session.
xlsclients shows a few thing, namely:
ubuntu-Standard-PC-Q35-ICH9-2009 spice-vdagent
ubuntu-Standard-PC-Q35-ICH9-2009 gsd-xsettings
ubuntu-Standard-PC-Q35-ICH9-2009 ibus-x11
ubuntu-Standard-PC-Q35-ICH9-2009 gnome-shell

When starting a X11 application, e.g. xeyes, xlsclients shows:
ubuntu-Standard-PC-Q35-ICH9-2009 spice-vdagent
ubuntu-Standard-PC-Q35-ICH9-2009 gsd-xsettings
ubuntu-Standard-PC-Q35-ICH9-2009 ibus-x11
ubuntu-Standard-PC-Q35-ICH9-2009 gnome-shell
ubuntu-Standard-PC-Q35-ICH9-2009 xeyes

Now, I've run
$ env --unset DISPLAY gnome-keysign

to make sure that it doesn't use X.
Note that gnome-keysign makes use of the gtk3 reactor.
Of course, it crashes due to the test in /usr/lib/python3/dist-packages/twisted/internet/gtk3reactor.py.
But after I have simply patched the whole test out, it ran fine.

xlsclients does not show the additional app.

I conclude that the gtk3 reactor runs fine with the DISPLAY variable being set. And it runs fine on Wayland.

@twisted-trac
Copy link
Author

muelli's avatar @muelli commented

#1379

@twisted-trac
Copy link
Author

twm's avatar @twm set owner to @twm
@twm set status to assigned

@twisted-trac
Copy link
Author

twm's avatar @twm removed owner
@twm set status to new

Approved: #1379 (review)

@twisted-trac
Copy link
Author

twm's avatar @twm set owner to @twm
@twm set status to closed

In changeset 6546d06

#!CommitTicketReference repository="" revision="6546d06769e4ca93771608fd4cbdb81d0654aa95"
Merge pull request #1379 from muelli/9904-muelli-wayland

Author: muelli
Reviewer: twm
Fixes: ticket:9904

gtk3: remove check for DISPLAY variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants