IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39038 for trunk


Ignore:
Timestamp:
Nov 3, 2015, 10:42:21 PM (11 years ago)
Author:
eugene
Message:

tighted code and raise a valid error if we fail to find the file or filename

File:
1 edited

Legend:

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

    r39015 r39038  
    535535               AND stage = 'diff'"
    536536
    537         try:
    538             rs = self.executeQuery(sql)
    539             rs.first()
    540         except:
    541             self.logger.infoPair("failed sql", sql)
    542             self.logger.errorPair("can't query for diff cmf", "dfif_skyfile_id = %d" %diff_skyfile_id)
     537        rs = self.executeQuery(sql)
     538
     539        if not rs.first():
     540            self.logger.errorPair("missing cmf entry diff_skyfile_id:", str(diff_skyfile_id))
     541            # self.logger.errorPair("no diff cmfs found for diff_skyfile_id = %d" %diff_skyfile_id)
    543542            return None
    544         print "query worked"
    545         try:
    546             pathBase = rs.getString(1)
    547         except:   
    548             self.logger.errorPair("no diff cmfs found for diff_skyfile_id = %d" %diff_skyfile_id)
    549             return None
    550         print pathBase
     543
     544        pathBase = rs.getString(1)
     545
    551546        files = []
    552547        if pathBase.startswith("neb"):
    553             print "open"
     548            self.logger.debugPair("searching for nebulous files", pathBase)
    554549            f=os.popen("neb-ls -p " + pathBase + ".cmf")
    555550            for i in f.readlines():
    556                 print "i",i
     551                self.logger.debugPair("real file", i.rstrip())
    557552                files.append(i.rstrip())
    558                 print "append"
    559 # No clue what this is here for, but it breaks things.               
    560 #        print i
    561553        else:
    562554            files = glob.glob(pathBase + ".cmf")
    563555
    564         if len(files) < 1: return None
     556        if len(files) < 1:
     557            self.logger.errorPair ("no cmf file found matching pathBase", pathBase + ".cmf")
     558            return None
     559
    565560        fits = Fits(self.logger, self.config, files[0])
    566561        return fits
Note: See TracChangeset for help on using the changeset viewer.