On Sat, 26 Apr 2008 01:24:23 -0700, jimgardener wrote: > hi > i have a directory containing .pgm files of P5 type.i wanted to read > the pixel values of these files ,so as a firststep i wrote code to > make a list of filenames using listdir > > pgmdir="f:\code\python\pgmgallery" # where i have pgm files > g2=listdir(pgmdir) > > i get the following error > WindowsError: [Error 123] The filename, directory name, or volume > label syntax is incorrect: 'f:\\code\\python\pgmgallery/*.*' > > i am running python on winXP ..can anyone tell me why i get this > error?
Did you try using a raw string as pathname pgmdir=r"f:\code\python\pgmgallery" ? AFAIK, the character '\' in interpreted in Python as the beginning of an escape sequence (such as '\n') and it should be doubled ( as in the error message) or a raw string should be used, telling Python that there are no escape sequences inside. However, from the message it looks like the path as been understood as such, so this might not be the case. Ciao ----- FB -- http://mail.python.org/mailman/listinfo/python-list