Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80917 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-11-17 09:01 +1100 |
| Last post | 2014-11-16 17:06 -0500 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-17 09:01 +1100
Re: How to fix those errors? Roy Smith <roy@panix.com> - 2014-11-16 17:06 -0500
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-17 09:01 +1100 |
| Subject | Re: How to fix those errors? |
| Message-ID | <mailman.15913.1416175276.18130.python-list@python.org> |
On Mon, Nov 17, 2014 at 8:32 AM, Abdul Abdul <abdul.sw84@gmail.com> 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
[toc] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-11-16 17:06 -0500 |
| Message-ID | <roy-AF4D6A.17061016112014@news.panix.com> |
| In reply to | #80917 |
In article <mailman.15913.1416175276.18130.python-list@python.org>, Chris Angelico <rosuav@gmail.com> wrote: > On Mon, Nov 17, 2014 at 8:32 AM, Abdul Abdul <abdul.sw84@gmail.com> 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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web