I recently got a Lenovo Duet Chromebook and had started using the Linux terminal to install Python and was using the IDLE Shell to run some basic commands. This was working fine until today, and now IDLE is failing to launch.
If I launch IDLE from the app drawer, then it pops up, but then instantly closes.
Running from the Terminal, I get the following error:
X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 55 (X_CreateGC)
Resource id in failed request: 0x40004a
Serial number of failed request: 1142
Current serial number in output stream: 1152
If I try to launch again, I get a slightly different error:
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module> main()
File "/usr/lib/python3.9/idlelib/pyshell.py", line 1483, in main root = Tk(className="Idle")
File "/usr/lib/python3.9/tkinter/init.py", line 2270, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"
I've tried turning off Linux and back on, and installing the packages again. I tried a powerwash as well, but after installing everything I still get the same error.
CodePudding user response:
The first error is coming from a call in the X11 client library, XCreateGC()
, or rather it is coming from the Xserver as it is processing the message. That's how such calls error out, and it is really rare! (I'd love to know what caused it; it's really not supposed to happen. If it is difficult to hunt down what caused it the problem in the first place, fixing it is even more difficult.)
The subsequent messages are about failing to connect to the Xserver at all, almost as if it has crashed. Which is very odd! If the Xserver has crashed, it needs to be restarted before you can connect to it again. That in turn might require some effort to rebuild session credentials. (It's possible that the easiest thing to do is to just reboot.)
Tk (and hence, by extension, tkinter) doesn't talk to other ways of rendering to the screen on ordinary Unix, mainly because nobody has ever contributed an alternate mechanism. Such alternates exist for some Unix derivatives such as macOS and Android, but to my knowledge nobody's done Wayland yet. I could be wrong.
CodePudding user response:
I have almost the same error. Python 3.9.2 installed (regular deb packages) on Linux environment (Crostini?) running on Asus Chromebook with up to date system. I'm able to run 'regular' X11 applications like gimp (xeyes and xlogo work as well), but there are issues with python's tkinter. Trivial program like:
import tkinter
tkinter.Tk()
displays empty window as expected, but more complex tkinter apps fail. Running IDLE produces:
wintermute@penguin:~$ idle
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python3.9/idlelib/pyshell.py", line 1483, in main
root = Tk(className="Idle")
File "/usr/lib/python3.9/tkinter/__init__.py", line 2270, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":0"
wintermute@penguin:~$