[Image-SIG] Help Opening an Image File

Fredrik Lundh fredrik at pythonware.com
Fri May 5 00:42:13 CEST 2006


Angela Traficante wrote:

> Quick question:  I tried using the Library to open an Image, but the
> interpretor can't find the image file.  I also can't find in the
> documentation where "import Image" is supposed to get the file from.  Does
> anyone know where I should put the file so that the Library/Interpretor can
> find it?

I'm not sure what you're asking here, really: do you have problems
importing the Image module, or do you have problems opening an
image with the Image.open function ?

if the latter, Python expects you to either provide a full path to the
file you want to open, or make sure that the file is in the current
directory (which is the default directory for all file operations).

you can do

    import os
    print os.getcwd()

to see what the current directory is set to.

(the "look for files relative to current directory" thing isn't specific for
PIL nor Python, of course; file access work like this on most platforms).

</F>





More information about the Image-SIG mailing list