python-mss icon indicating copy to clipboard operation
python-mss copied to clipboard

ScreenShotError("gdi32.GetDIBits() failed.")

Open fidel-perez opened this issue 3 years ago • 0 comments

General information:

  • OS name: Windows 10
  • OS version: 19042.1415
  • OS architecture: 64 bits
  • Resolutions:
    • Monitor 1: 1920x1080
  • Python version: 3.9.6
  • MSS version: 6.1.0

Description of the warning/error

The following piece of code is being called for ~6 hours, about once a minute. After 6 hours the error starts to be thrown. This has happened several times, it is a consistent situation. I have checked all the previous bug reports with the same issue and I don't see what could be happening.

with mss.mss() as sct:
    haystack_img = np.array(sct.grab(image_input))

Full message

  File "D:\Dropbox\git\img-testing\common_image_recognition.py", line 103, in extract_image_from_input
    haystack_img = np.array(sct.grab(image_input))
  File "C:\Python39\lib\site-packages\mss\base.py", line 88, in grab
    return self._grab_impl(monitor)
  File "C:\Python39\lib\site-packages\mss\windows.py", line 285, in _grab_impl
    raise ScreenShotError("gdi32.GetDIBits() failed.")

Other details

Thank you!

fidel-perez avatar Jan 06 '22 07:01 fidel-perez