Image open problem
John Machin
sjmachin at lexicon.net
Wed Apr 19 20:29:23 EDT 2006
On 20/04/2006 6:55 AM, Aleksandar Cikota wrote:
> Hi all,
>
> I have a problem with openning of an image.
>
> Here is the Code:
>
> from Tkinter import *
> from PIL import Image, ImageTk
Insert here:
print type(Image), type(Image.open), Image.version
Here are my results:
Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image, ImageTk
>>> Image.VERSION
'1.1.5'
>>> type(Image)
<type 'module'>
>>> type(Image.open)
<type 'function'>
... which is what I expected
[snip]
If the print statement gives incorrect results, I'd advise re-installing
PIL.
If it gives correct results, add a copy of the print further towards
where the error occurs. Binary search until you have found the culprit
that is mangling Image.
> image = Image.open('G:/Robot teleskop/VRT/'+
> str(name[0:-4])+'.jpg')
I thought I'd already seen somebody point out to you that all those
str() calls are rather redundant ...
[snip]>
>
> The error message:
> Exception in thread TestThread:
> Traceback (most recent call last):
> File "C:\Program Files\Python\lib\threading.py", line 442, in __bootstrap
> self.run()
> File "G:\Robot teleskop\VRT\soft\GUI.py", line 60, in run
> image = Image.open('G:/Robot teleskop/VRT/'+ str(name[0:-4])+'.jpg')
> AttributeError: 'function' object has no attribute 'open'
The implication is that Image is a function, which is weird.
>
>
> I think the modul is not imported how it should be. I hope for help.
More information about the Python-list
mailing list