Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python imagegrab module not found

I'm using Python 2.7, and I am looking through one of the tuts+ tutorials

I am unable to import one of the modules in their first code segment, the ImageGrab module. I reinstalled Python Imaging Library, and checked to make sure the folder was in the site-packages. On the tuts+ site, there is a link to fixing filepaths but it is broken, and I tried looking on that site and on google for fixing the module path, but nothing worked. How can I get Python to discover the PIL module?

Thanks for any help

EDIT: So, found the problem (not really a problem, more of a cygwin doesn't want to play nice thing). If I opened the python file in the IDLE and ran the program from there using the run module command, it worked just fine. It was just command line python stuff that didn't work. Even after trying a variety of fixes, it would keep yelling about not having this file or that module (like _imaging, or Image, or anything else).

like image 323
user1938805 Avatar asked Sep 09 '13 00:09

user1938805


People also ask

How to use ImageGrab Python?

grab() method takes a snapshot of the screen. The pixels inside the bounding box are returned as an “RGB” image on Windows or “RGBA” on macOS. If the bounding box is omitted, the entire screen is copied.

How do I import an image module into Python?

To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).


2 Answers

Have you tried:

from PIL import ImageGrab

worked for me...

like image 176
Shujal Avatar answered Nov 15 '22 10:11

Shujal


have you tried with import Image instead of from PIL import Image? sometimes this solves the issue.

from PIL import Image
like image 27
D4NI3LS Avatar answered Nov 15 '22 09:11

D4NI3LS