[Tutor] Image Question, List of Image Colors

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Jan 11 23:19:37 CET 2007

> I'm trying to do what Kent suggested, but I have a little problem, no 
> matter were I put my image or if I use sys.path.append to append the 
> folder were my Image is located it is impossible to open the image. I 
> know that this is a silly question but what is going on?

sys.path contains a list of paths that Python will use to search for 
modules.  It does not affect anything else.  In particular, adding it 
won't affect the paths that PIL uses to open files.

> sys.path.append('D:\MASTER THESIS\Branch_01\Thesis B_01\images\tmp')
> im = Image.open("Wind_Test_01")

You can build up the fulle path name, using os.path.join:


By the way, beware backslashes in your path there.  You can use forward 
slashes with fewer problems.  The reason backslashes are more problematic 
is because it almost always collides with the way we make string literal 
escapes in Python.

More information about the Tutor mailing list