-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
"X get_image failed: error 8 (73, 0, 924)" when trying to execute a script #5130
Comments
Hi. Yes, it is a Pillow error message. Line 928 in ff9715f
My guess is that the solution involves passing an Not sure how familiar you are with X, but if you open up your command line and run |
The output from the command line when I ran that returned with Don't know if I should use that, or... |
Okay, update. I changed the code to Still have no clue what any of it means. |
So, the bot is trying to take screenshots. That is the method it is using to determine where objects are in the game. X is the name of a windowing system for Linux. My suggestion was that maybe it's trying to take a screenshot of the wrong display. |
The error codes are from the X server or library. I can only find the list at http://www.rahul.net/kenton/xproto/xevents_errors.html, but you can see that, for example, error 5 is a parse error (caused by the omitted semicolon). Based on that list, error 8 is a bad parameter, but more information is hard to find. What are your screen settings (resolution, bit depth)? Since you mention you are running in a "Linux Command-Line VM", do you even have a screen (in the VM)? |
I don't think there's enough information here about the user's setup to solve this. It is entirely possible that the problem is that there isn't a display attached to the environment. So closing due to lack of response. If you have more information, comment and this can be re-opened. |
Hi, I am getting a similar error from PIL import ImageGrab
printscreen = ImageGrab.grab(xdisplay=":0") EnvironmentFedora 33 Any help would be appreciated |
The error code is 8. After looking at https://stackoverflow.com/questions/56562823/xcb-get-image-reply-fails-for-window-on-another-workspace-desktop, it seems to be saying that Pillow is trying to screenshot something not on the screen. ...do you have multiple monitors attached? |
No I have only one monitor |
What happens if you run just |
I get the same error |
If you open up your command line and run |
It shows |
https://stackoverflow.com/a/42447160 suggests that one needs to map the window first. So I've thrown in |
Ok, I am trying to install the library from the
I am not sure that I install it correctly, I haven't installed manually a module for python before. |
That's a common error when compiling Pillow from source - you are, as it says, missing a jpeg dependency. https://pillow.readthedocs.io/en/stable/installation.html#building-on-windows
|
Thanks I compiled it, but I get: |
I've pushed a commit to the same branch to |
I was unable to reproduce this in Ubuntu 20.04 in VirtualBox on my macOS machine. Fedora 33 is now EOL. So I tried Fedora 35 in VirtualBox... and I could reproduce it! So I'm unable to find any evidence that this is a problem with Pillow itself. |
I got the same error on Debian 11, and found that in my case it was caused by Gnome using Wayland and not Xorg. Logging in using Gnome on Xorg solved the problem. |
Is there a built-in tool to take screenshots that works on Wayland? It might be worth looking at its source to compare differences. |
I get the same error running Ubuntu 21.10 running on VMware Worksation 15 Player on my Windows 10 laptop. The Ubuntu VMware is running Python 3.9.7, with $DISPLAY set to ":0" and is simulting a single monitor. I installed Pillow 8.0.0. I got the error running this from the command line: >>> from PIL import ImageGrab
>>> ImageGrab.grab()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/al/.local/share/virtualenvs/deleteme-kZADQq03/lib/python3.9/site-packages/PIL/ImageGrab.py", line 64, in grab
size, data = Image.core.grabscreen_x11(xdisplay)
OSError: X get_image failed: error 8 (73, 0, 335) I get the same error when running the latest Pillow 9.1.0 too (except the error happens on line 68 of ImageGrab.py) As a note, Ubuntu has used Wayland by default since 21.04. When getting screenshots with the mss library, I get the error "mss.exception.ScreenShotError: XGetImage() failed" which makes me think this might be an X-versus-Wayland issue. |
This is definitely an issue of Pillow not working on Wayland. I made one change in my Ubuntu 21.10 vm: modifying |
The question of Wayland now has a dedicated issue - #6312 |
Thanks! It worked for me! 🦆 🥂 |
I was having the same issue, i read this thread and logged out of Ubuntu and changed my display protocol from wayland to xorg (using the small dial at the bottom right corner on the login screen) and ImageGrab.Grab() works perfectly now. |
Thanks! It worked for me! |
thanks!!!!!!!!!!!!!!! |
It is worked !!! Thanks a lot!!! |
What did you do?
I executed a script
What did you expect to happen?
A bot to run so it would play the Chrome Dinosaur Game for me.
What actually happened?
X get_image failed: error 8 (73, 0, 924)
What are your OS, Python and Pillow versions?
This is not my script, I don't know Python. I do, however, know that this is an issue with the Pillow Library and that's why I'm bringing it here and not the script owner's GitHub repo.
The text was updated successfully, but these errors were encountered: