I am trying to take a screenshot with the pyautogui
module, but keep getting this error
>>> image = pyautogui.screenshot()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pyautogui' has no attribute 'screenshot'
Is there something I'm missing? The chapter in Automate the Boring Stuff with Python said that as I'm on Windows, I shouldn't need to download anything other than pyautogui
itself for this to work. Anyone know why this might happen? Thanks in advance.
EDIT: I am using Anaconda so I already have Pillow
.
I have tried. It's seem to different from the document. to hope this is helpful.
On Linux, you must run
sudo apt-get install scrot
to use the screenshot features.It looks like PyAutoGUI is simply borrowing ImageGrab from PIL/Pillow which you can see by looking in pyautogui inside of screeenshotUtil.py
and further down
I had the same trouble as OP, but after realizing the above I used ImageGrab directly. Drawing inspiration from the comment section here an answer to OP on windows having pillow installed would look like this:
Before useing "image = pyautogui.screenshot()", you had to type "import pyautogui" before