Python 3 pyAutoGUI – I can't use screenshot functions


I tried an import from the documentation:

import pyautgui"select.png"))

and I get these errors in line 2:

File "", line 267, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.

File "", line 314, in _screenshot_win32
im = ImageGrab.grab()

NameError: name 'ImageGrab' is not defined

Could you help?

Asked By: paul marguerite



Looks like you need to import ImageGrab

from PIL import ImageGrab
Answered By: skr

i thinhk you need to update pillow
pip in

Answered By: Mr.Lee