Reputation: 363
I get the following error running the simple python script below:
Traceback (most recent call last):
File "/home/user/Desktop/python/folder/pil_test.py", line 4, in <module>
im = Image.open('screenshot.png')
AttributeError: 'module' object has no attribute 'open'
I run Debian Wheezy with KDE. I have installed pillow via pip.
The script ran well on my previous system, so I suspect the issue lies outside of my source code.
I feel slit up and have no idea where to start to solve that issue. Just reinstalling pillow did not do the job for me.
What else could I do?
from PIL import Image
im = Image.open('screenshot.png')
left = '10'
top = '10'
right = '10'
bottom = '10'
im = im.crop((left, top, right, bottom)) # defines crop points
im.save('screenshot.png')
Upvotes: 1
Views: 1708
Reputation: 363
It appears uninstalling 'pillow' and install 'pil' did the job for me:
sudo pip uninstall pillow
sudo pip install pil
This is strange in so far as I thought installing pillow via pip must have included PIL automatically.
I do not know why. But it works now!
Upvotes: 1