Changeset 40126

Show
Ignore:
Timestamp:
08/26/2017 07:21:58 AM (4 weeks ago)
Author:
heather
Message:

fits.py would hang when encountering a 0 length file, now it correctly faults and crashes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/fits.py

    r39764 r40126  
    3939               time.sleep(time_wait) 
    4040               time_wait= 120 #(first time, wait 30 seconds) 
     41                
    4142 
    4243       if success == 0: 
     
    4445           return            
    4546 
     47       if os.path.getsize(self.originalPath)==0: 
     48           success = 0 
     49           self.logger.errorPair("empty file, 0 bytes", self.originalPath) 
     50           return            
    4651       # does this file even exist? 
    4752       #if not os.path.isfile(self.originalPath):  
     
    5863       # open the local copy and parse the header 
    5964       #self.file = open(self.localCopyPath) 
     65       self.logger.infoPair("opening FITS file",self.originalPath) 
    6066       self.file = open(self.originalPath) 
     67       self.logger.infoPair("parsing", "header") 
    6168       self.header = self.parseHeader() 
     69 
    6270       #self.logger.debugPair("FITS local copy", self.localCopyPath) 
    63        self.logger.debugPair("FITS primary header", "%d cards found" % len(self.header)) 
     71       self.logger.infoPair("FITS primary header", "%d cards found" % len(self.header)) 
    6472 
    6573       # move file pointer back to the start of the file