I'm trying to use pyautogui
's screenshot functions with Python 3.6.5 on OSX 10.11.
>>> import pyautogui
>>> image = pyautogui.screenshot()
I get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyscreeze/__init__.py", line 331, in _screenshot_osx
im = Image.open(tmpFilename)
NameError: name 'Image' is not defined
My understanding is that pyscreeze
is failing to get the name Image
from Pillow
for some reason. I tried to update the pyautogui
(it was up to date), then reinstall the pyautogui
, which carries all its dependencies including pyscreeze
and Pillow
along with it.
I found this question with the same issue, but the fix that worked there (reinstalling) isn't working for me.
The screenshot() Function Calling screenshot() will return an Image object (see the Pillow or PIL module documentation for details). Passing a string of a filename will save the screenshot to a file as well as return it as an Image object.
Start by putting the cursor at the top left of the region you'd like to capture, then press enter. Next move to the bottom right of the region you're looking for, and again, press enter. Hope this helps!
do
pip install Pillow==0.1.13
since Image is module from PIL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With