How to fix Xlib.error.DisplayConnectionError: Cannot connect to display ": 0": b'On the specified protocol \ n '

I am doing some program with python3 and XLib.

On my PC with Ubuntu 14.04 everything works fine, but when I try to run the application on my laptop with manually installed Xorg, I get an exception:

Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n' 

in line:

 self.__display = Xlib.display.Display() 

What's going on here? How to fix this so that it can work on every Linux?

Edit:

This is not like a duplicate of X11: run the gnome application as another user . I have the same users and groups on both of my computers, so this problem is probably not related to the lack of permissions to run my program.

It must be something else with a bad X configuration.

+4
source share
2 answers

Ok, that was a bug in python3-xlib. See https://github.com/LiuLang/python3-xlib/issues/6 for more details.

+2
source

Workaround Workaround

 $ xhost + 

http://ubuntuforums.org/showthread.php?t=2290602

+6
source

All Articles