Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: How to fix those errors? Date: Sun, 16 Nov 2014 17:06:40 -0500 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 29 Message-ID: References: NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1416175601 20417 127.0.0.1 (16 Nov 2014 22:06:41 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sun, 16 Nov 2014 22:06:41 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:80920 In article , Chris Angelico wrote: > On Mon, Nov 17, 2014 at 8:32 AM, Abdul Abdul wrote: > > from PIL import Image > > import os > > > > for inputfile in filelist > > outputfile = os.path.splitext(inputfile)[0]+".jpg" > > if inputfile != outputfile: > > try: > > Image.open(inputfile).save(outputfile) > > except IOError: > > print "unable to convert ", inputfile > > The first issue I'm seeing here is that your indentation is messed up. > I've no idea where your example is coming from, but somewhere between > working code and what I'm seeing in front of me, some lines have > become indented further than they should. > > You'll also need to figure out what the list of files should be. > That's why you're seeing errors about 'filelist'. > > ChrisA Not to mention the missing ":" at the end of the "for" statement. Please, people, when asking questions about code, copy-paste what you're running into your post. Then we see exactly what you've got, and at least have a chance of figuring out what's wrong.