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).
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.
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).
Have you tried:
from PIL import ImageGrab
worked for me...
have you tried with import Image instead of from PIL import Image? sometimes this solves the issue.
from PIL import Image
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