Reputation: 91
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).
Upvotes: 7
Views: 35335
Reputation: 11
Try typing this in your commandline
C:\Users"your pc username"\PycharmProjects"your project name"\venv\Scripts\python.exe -m pip install --upgrade pip
for me this worked
Upvotes: 0
Reputation: 11
# Importing Image and ImageGrab module from PIL package
from PIL import Image, ImageGrab
# creating an image object
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG")
# using the grab method
im2 = ImageGrab.grab(bbox = None)
im2.show()
Upvotes: 1
Reputation: 1633
The pyscreenshot module can be used to copy the contents of the screen to a PIL image memory or file. Replacement for the ImageGrab Module, which works on Windows only.
Links: home: https://github.com/ponty/pyscreenshot documentation: http://ponty.github.com/pyscreenshot
Go through this link:
https://pypi.python.org/pypi/pyscreenshot
Upvotes: 0
Reputation: 315
have you tried with import Image instead of from PIL import Image? sometimes this solves the issue.
from PIL import Image
Upvotes: 4