Show
Ignore:
Timestamp:
11/25/08 00:54:51 (16 years ago)
Author:
jerome
Message:

Ensures the temporary files are always closed (they should be anyway,
but it seems it's not the case for some people...)

Files:
1 modified

Legend:

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

    r3457 r3460  
    5757        self.filename = filename 
    5858        self.workfile = None 
    59         self.mustclose = None 
    6059 
    6160    def getJobSize(self) : 
     
    102101    def openFile(self) : 
    103102        """Opens the job's data stream for reading.""" 
    104         self.mustclose = False  # by default we don't want to close the file when finished 
    105103        if hasattr(self.filename, "read") and hasattr(self.filename, "seek") : 
    106104            # filename is in fact a file-like object 
     
    112110            # normal file 
    113111            self.workfile = open(self.filename, "rb") 
    114             self.mustclose = True 
    115112            return 
    116113 
     
    131128    def closeFile(self) : 
    132129        """Closes the job's data stream if we have to.""" 
    133         if self.mustclose : 
    134             self.workfile.close() 
     130        self.workfile.close() 
    135131 
    136132    def readFirstAndLastBlocks(self, inputfile) :