i am trying to do something with the PIL Image library in django, but i experience some problems.
I do like this:
import Image
And then I do like this
images = map(Image.open, glob.glob(os.path.join(dirpath, '*.thumb.jpg')))
But when i try to run this i get an error and it leeds me to think that its not imported correctly, anybody know?
type object 'Image' has no attribute 'open'
The error above happens because your file is called Image.py and you’re trying to import yourself. As Manual pointed out, you should import Image from the PIL module, but you’d also need to rename your file so it’s not called Image.py.