tags:

views:

88

answers:

2

The trivial

import Image
im = Image.OPEN('C:\abc.bmp')

results in the following exception

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    im = Image.OPEN('C:\Documents and Settings\umair.ahmed\My Documents\My Pictures\avanza.bmp')
TypeError: 'dict' object is not callable

not sure if i am missing something, kindly help.

+3  A: 

Use:

Image.open()

It's case-sensitive.

Swingley
Ah the code completion was giving me 'OPEN' in all caps!!!
Umair Ahmed
Based upon the error message, `Image.OPEN` is a `dict`.
Alok
+1  A: 

I don't think the error message came from your input, because the file names are different, but you should not use 'C:\abc.bmp', in your open() call, but use either C:/abc.bmp, or r'C:\abc.bmp'. Backslash is an escape character in Python.

Alok
yep i changed 'c:\abc.bmp' to 'c:\\abc.bmp' but the main problem was as @Swingley suggested. Thanx for suggesting r'c:\abc.bmp' its far more convenient.
Umair Ahmed