Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80906

How to fix those errors?

Date 2014-11-16 22:32 +0100
Subject How to fix those errors?
From Abdul Abdul <abdul.sw84@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15903.1416173691.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello,

I'm walking through an example that goes as follows:

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

I'm writing that in "Pycharm", and getting the following errors:

* filelist ---> Unresolved reference 'filelist'

* IOError: Statement seems to have no effect

* The last 'filelist' ---> 'except' or 'finally' expected

How can I solve those errors?

Thanks.

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

How to fix those errors? Abdul Abdul <abdul.sw84@gmail.com> - 2014-11-16 22:32 +0100
  Re: How to fix those errors? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-16 23:04 +0100
    Re: How to fix those errors? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-16 23:13 +0100
      Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-17 09:22 +1100
        Re: How to fix those errors? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-17 11:38 +1100
          Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-17 12:05 +1100
          Re: How to fix those errors? Roy Smith <roy@panix.com> - 2014-11-16 21:55 -0500
            Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-17 14:06 +1100
              Re: How to fix those errors? alex23 <wuwei23@gmail.com> - 2014-11-19 13:02 +1000
                Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-19 14:40 +1100
                Re: How to fix those errors? alex23 <wuwei23@gmail.com> - 2014-11-21 20:21 +1000
            Re: How to fix those errors? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-11-18 20:25 +1300
              Re: How to fix those errors? Chris Angelico <rosuav@gmail.com> - 2014-11-18 18:37 +1100
              Re: How to fix those errors? wxjmfauth@gmail.com - 2014-11-19 08:00 -0800
            Re: How to fix those errors? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-19 09:33 +1100

csiph-web