Starting to work through "Programming Computer Vision with Python" in my -summer of learning python- quest. As I read through the intro to the PIL library, I came across the below code. When I read it, I said to my self "I don't see how that calls a set of files, there's no specificity. How does that know where to call from?" Then I convinced myself that, because I'm a beginner, I must be missing something, and ran it through the interpreter. Of course, I got an error message telling me filelist isn't defined. But now I'm kinda lost.
If the directory holding the pics I want to work on is called practicephotos, should I declare something along the lines of filelist = ~/practicephotos/ or what? regards, Richard [code] from PIL import Image import os for infile in filelist: outfile - os.path.splitext(infile)[0] + ".jpg" if infile != outfile: try: Image.open(infile).save(outfile) except IOError: print "cannot convert", infile [/code] -- "Treat all disasters as if they were trivialities but never treat a triviality as if it were a disaster." -- *Quentin Crisp<http://www.quotationspage.com/quotes/Quentin_Crisp> *
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor