Changeset 427 for pkpgcounter/trunk

Show
Ignore:
Timestamp:
10/17/06 09:21:54 (18 years ago)
Author:
jerome
Message:

Ensures the temporary file is removed in all cases.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/analyzer.py

    r416 r427  
    8383            try : 
    8484                pdlhandler = self.detectPDLHandler() 
    85                 tiffname = self.convertToTiffMultiPage24NC(pdlhandler) 
    86                 result = inkcoverage.getInkCoverage(tiffname, cspace) 
    8785                try : 
    88                     os.remove(tiffname) 
    89                 except OSError : 
    90                     sys.stderr.write("Problem when trying to remove temporary file %s\n" % tiffname) 
     86                    tiffname = self.convertToTiffMultiPage24NC(pdlhandler) 
     87                    result = inkcoverage.getInkCoverage(tiffname, cspace) 
     88                finally :     
     89                    try : 
     90                        os.remove(tiffname) 
     91                    except OSError : 
     92                        sys.stderr.write("Problem when trying to remove temporary file %s\n" % tiffname) 
    9193            except pdlparser.PDLParserError, msg :     
    9294                raise pdlparser.PDLParserError, "Unknown file format for %s (%s)" % (self.filename, msg)