Esempio n. 1
0
def instrumid(struct,file,logfile):
    """identify instrument in keywords"""

    instrume = ''
    keyprep = ''
    keygain = ''
    keybias = ''
    keyxtalk = ''
    keyslot = ''
    status = 0
    try:
        instrume = struct[0].header['INSTRUME']
        if (string.join(instrume.split(),"") == 'RSS' or string.join(instrume.split(),"") == 'PFIS'):
            keyprep = 'PPREPARE'
            keygain = 'PGAIN'
            keybias = 'PBIAS'
            keyxtalk = 'PXTALK'
            keyslot = 'PSLOT'
        elif (string.join(instrume.split(),"") == 'SALTICAM'):
            keyprep = 'SPREPARE'
            keygain = 'SGAIN'
            keybias = 'SBIAS'
            keyxtalk = 'SXTALK'
            keyslot = 'SSLOT'
        else:
            message = 'ERROR -- SALTKEY.INSTRUMID: INSTRUME keyword not '
            message += 'recognized in file ' + file
            status = saltprint.err(logfile,message)
    except:
        message = 'ERROR -- SALTKEY.INSTRUMID: INSTRUME keyword not found '
        message += 'in file ' + file
        status = saltprint.err(logfile,message)

    return instrume,keyprep,keygain,keybias,keyxtalk,keyslot,status
Esempio n. 2
0
def symlink(infile,linkfile,clobber,verbose,logfile):

# delete file if one of the same name already exists

    status = 0
    message = 'SALTIO.SYMLINK -- created symbolic link from ' + infile + ' to ' + linkfile
    if (os.path.exists(linkfile) and not clobber):
        message = 'ERROR: SALTIO.SYMLINK -- file ' + linkfile + ' exists, use clobber=y'
        status = saltprint.err(logfile,message)
    if (status == 0 and clobber):
        try:
            os.remove(linkfile)
        except:
            status = 0

# create symbolic link

    if (status == 0):
        try:
            os.symlink(infile,linkfile)
        except:
            message  = 'ERROR: SALTIO.SYMLINK -- could not create symbolic link from '
            message += infile + ' to ' + linkfile
            status = saltprint.err(logfile,message)
    if (status == 0): saltprint.log(logfile,message,verbose)

    return status
Esempio n. 3
0
def cleanpropcode(pids, propids, logfile):
    status=0
    props = []

    #Make a list of all the Propcodes that are observed
    for pid in propids:
        props.extend(pid.upper().split(','))

    #Check to make sure that the requested propocodes
    # are in that night's observation or set the propocodes
    # to all of that nights observatoins
    if (pids[0].upper() != 'ALL'):
        for pid in pids:
            for pid in pid.split(','):
                if (pid.upper().strip() not in set(props)):
                    message  = 'ERROR: CLEANPROPCODE -- Propcode ' + pid.upper()
                    message += ' is not recorded in the observation log '
                    status = saltprint.err(logfile,message)
    else:
        pids = set(props)

    pids=removebadpids(pids)

    if not pids:
        message  = 'ERROR: CLEANPROPCODE -- Propcode list is empty'
        status = saltprint.err(logfile,message)
    return pids, status
Esempio n. 4
0
def symlink(infile,linkfile,clobber,verbose,logfile):

# delete file if one of the same name already exists

    status = 0
    message = 'SALTIO.SYMLINK -- created symbolic link from ' + infile + ' to ' + linkfile
    if (os.path.exists(linkfile) and not clobber):
        message = 'ERROR: SALTIO.SYMLINK -- file ' + linkfile + ' exists, use clobber=y'
        status = saltprint.err(logfile,message)
    if (status == 0 and clobber):
        try:
            os.remove(linkfile)
        except:
            status = 0

# create symbolic link

    if (status == 0):
        try:
            os.symlink(infile,linkfile)
        except:
            message  = 'ERROR: SALTIO.SYMLINK -- could not create symbolic link from '
            message += infile + ' to ' + linkfile
            status = saltprint.err(logfile,message)
    if (status == 0): saltprint.log(logfile,message,verbose)

    return status
Esempio n. 5
0
def cleanpropcode(pids, propids, logfile):
    status=0
    props = []

    #Make a list of all the Propcodes that are observed
    for pid in propids:
        props.extend(pid.upper().split(','))

    #Check to make sure that the requested propocodes
    # are in that night's observation or set the propocodes
    # to all of that nights observatoins
    if (pids[0].upper() != 'ALL'):
        for pid in pids:
            for pid in pid.split(','):
                if (pid.upper().strip() not in set(props)):
                    message  = 'ERROR: CLEANPROPCODE -- Propcode ' + pid.upper()
                    message += ' is not recorded in the observation log '
                    status = saltprint.err(logfile,message)
    else:
        pids = set(props)

    pids=removebadpids(pids)

    if not pids:
        message  = 'ERROR: CLEANPROPCODE -- Propcode list is empty'
        status = saltprint.err(logfile,message)
    return pids, status
Esempio n. 6
0
    def _finishcallsave(self, e):
        status=0
        self.sroot.destroy()
        name=self.nametext.get()
        if not name: return
        if name[-3:]!='.ps': name=name+'.ps'

        #remove the file if the name already exists
        if saltio.filedoesnotexist(name,self.verbose, self.logfile):
            if self.clobber:
                os.remove(name)
            else:
                message = 'ERROR -- SALTVIEW: File ' + name + ' already exists, use clobber=y'
                status = saltprint.err(logfile,message)
                return

        #turn the red dot off in the graph
        self.light_point.set_visible(False)

        #save the figure
        self.lcfig.savefig(name)


        #turn the red dot on in the graph
        self.light_point.set_visible(True)
Esempio n. 7
0
def readgaindb(gaindb,logfile):

    dbspeed = []
    dbrate  = []
    dbgain  = []
    dbnoise = []
    dbbias  = []
    dbamp   = []
    status  = 0
    try:
        gainfile = open(gaindb,'r')
        for line in gainfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = re.sub("\s+",",",line)
                line.rstrip(',')
                entries = line.split(',')
                dbspeed.append(entries[0])
                dbrate.append(entries[1])
                dbgain.append(entries[2])
                dbnoise.append(entries[3])
                dbbias.append(entries[4])
                dbamp.append(entries[5].strip('amp'))
    except:
        message = 'Cannot read gain database file ' + gaindb
        status = saltprint.err(logfile,message)

    return dbspeed, dbrate, dbgain, dbnoise, dbbias, dbamp, status
Esempio n. 8
0
def readccdgeom(geomfile,logfile,status):

    status = 0
    gap = 0.
    xshift = [0., 0.]
    yshift = [0., 0.]
    rot = [0., 0.]
    try:
        gfile = open(geomfile,'r')
        for line in gfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = line.rstrip().lstrip()
                line = re.sub("\s+",",",line)
                pars = line.split(',')
                gap = float(pars[1])
                xshift[0] = float(pars[2])
                yshift[0] = float(pars[3])
                rot[0] = float(pars[4])
                if (len(pars) == 8):
                    xshift[1] = float(pars[5])
                    yshift[1] = float(pars[6])
                    rot[1] = float(pars[7])
    except:
        message = 'ERROR -- SALTIO.READCCDGEOM: Cannot read geometry definition parameters '
        message += 'in file ' + geomfile
        status = saltprint.err(logfile,message)

    return gap, xshift, yshift, rot, status
Esempio n. 9
0
def readccdgeom(geomfile,logfile,status):

    status = 0
    gap = 0.
    xshift = [0., 0.]
    yshift = [0., 0.]
    rot = [0., 0.]
    try:
        gfile = open(geomfile,'r')
        for line in gfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = line.rstrip().lstrip()
                line = re.sub("\s+",",",line)
                pars = line.split(',')
                gap = float(pars[1])
                xshift[0] = float(pars[2])
                yshift[0] = float(pars[3])
                rot[0] = float(pars[4])
                if (len(pars) == 8):
                    xshift[1] = float(pars[5])
                    yshift[1] = float(pars[6])
                    rot[1] = float(pars[7])
    except:
        message = 'ERROR -- SALTIO.READCCDGEOM: Cannot read geometry definition parameters '
        message += 'in file ' + geomfile
        status = saltprint.err(logfile,message)

    return gap, xshift, yshift, rot, status
Esempio n. 10
0
def readgaindb(gaindb,logfile):

    dbspeed = []
    dbrate  = []
    dbgain  = []
    dbnoise = []
    dbbias  = []
    dbamp   = []
    status  = 0
    try:
        gainfile = open(gaindb,'r')
        for line in gainfile:
            if (len(line.strip()) > 0 and line[0] != '#'):
                line = line.rstrip('\r\n')
                line = re.sub("\s+",",",line)
                line.rstrip(',')
                entries = line.split(',')
                dbspeed.append(entries[0])
                dbrate.append(entries[1])
                dbgain.append(entries[2])
                dbnoise.append(entries[3])
                dbbias.append(entries[4])
                dbamp.append(entries[5].strip('amp'))
    except:
        message = 'Cannot read gain database file ' + gaindb
        status = saltprint.err(logfile,message)

    return dbspeed, dbrate, dbgain, dbnoise, dbbias, dbamp, status
Esempio n. 11
0
def comparelists(list1,list2,name1,name2,logfile):

    status = 0
    if (len(list1) != len(list2)):
        message = 'ERROR -- SALTIO.COMPARELISTS: ' + name1 + ' and ' + name2
        message += ' lists are of unequal length'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 12
0
def argdefined(argument,value,logfile):

    status = 0
    value = value.strip()
    if (len(value) == 0): # or value.count(' ') > 0):
        message = 'ERROR -- SALTIO.ARGDEFINED: ' + argument + ' argument not defined'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 13
0
def filedefined(filetype,file,logfile):

    status = 0
    file = file.strip()
    if (len(file) == 0 or file.count(' ') > 0):
        message = 'ERROR -- SALTIO.FILEDEFINED: ' + filetype + ' file(s) not specified'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 14
0
def fileexists(file,logfile):

    status = 0
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.FILEEXISTS: File ' + file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 15
0
def filedefined(filetype,file,logfile):

    status = 0
    file = file.strip()
    if (len(file) == 0 or file.count(' ') > 0):
        message = 'ERROR -- SALTIO.FILEDEFINED: ' + filetype + ' file(s) not specified'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 16
0
def argdefined(argument,value,logfile):

    status = 0
    value = value.strip()
    if (len(value) == 0): # or value.count(' ') > 0):
        message = 'ERROR -- SALTIO.ARGDEFINED: ' + argument + ' argument not defined'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 17
0
def fileexists(file,logfile):

    status = 0
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.FILEEXISTS: File ' + file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 18
0
def filesexist(infiles,path,mode,logfile):

    status = 0
    if (path != ''):
        if (path[len(path)-1] != '/'): path += '/'
    for fileitem in infiles:
        if (mode == 'r'):
            if (not os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' does not exist'
                status = saltprint.err(logfile,message)
        elif (mode == 'w'):
            if (os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' already exists'
                status = saltprint.err(logfile,message)
    return status
Esempio n. 19
0
def writefits(struct,file,logfile):

    status = 0
    try:
        struct.writeto(file)
    except Exception, e:
        message = 'ERROR -- SALTIO.WRITE: cannot write %s because %s' % (file, e)
        status = saltprint.err(logfile,message)
Esempio n. 20
0
def comparelists(list1,list2,name1,name2,logfile):

    status = 0
    if (len(list1) != len(list2)):
        message = 'ERROR -- SALTIO.COMPARELISTS: ' + name1 + ' and ' + name2
        message += ' lists are of unequal length'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 21
0
def filesexist(infiles,path,mode,logfile):

    status = 0
    if (path != ''):
        if (path[len(path)-1] != '/'): path += '/'
    for fileitem in infiles:
        if (mode == 'r'):
            if (not os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' does not exist'
                status = saltprint.err(logfile,message)
        elif (mode == 'w'):
            if (os.path.isfile(path+fileitem)):
                message = 'ERROR -- SALTIO.FILESEXIST file ' + path + fileitem
                message += ' already exists'
                status = saltprint.err(logfile,message)
    return status
Esempio n. 22
0
def email(server,username,password,sender,recipient,subject,message,logfile):

    status = 0

# connect to email server

    try:
        smtp = smtplib.SMTP()
        smtp.connect(server)
    except:
        message = 'ERROR: SALTIO.EMAIL -- cannot connect to email server ' + server
        status = saltprint.err(logfile,message)

# login to email server

    if (status == 0):
        try:
            smtp.login(username,password)
        except:
            message = 'ERROR: SALTEMAIL -- cannot login to email server ' + server + ' as user ' + username
            status = saltprint.err(logfile,message)

# send emails

    if (status == 0):
        msg = MIMEText(message)
        msg['Subject'] = subject
        msg['From'] = sender
        msg['To'] = recipient
        try:
            smtp.sendmail(sender,recipient,msg.as_string())
        except:
            message = 'ERROR: SALTEMAIL -- failed to send email to ' + recipient
            status = saltprint.err(logfile,message)

# disconnect from email server

    if (status == 0):
        try:
            smtp.quit()
        except:
            message = '\nERROR: SALTEMAIL -- cannot disconnect from email server ' + server
            status = saltprint.err(logfile,message)

    return status
Esempio n. 23
0
def email(server,username,password,sender,recipient,subject,message,logfile):

    status = 0

# connect to email server

    try:
        smtp = smtplib.SMTP()
        smtp.connect(server)
    except:
        message = 'ERROR: SALTIO.EMAIL -- cannot connect to email server ' + server
        status = saltprint.err(logfile,message)

# login to email server

    if (status == 0):
        try:
            smtp.login(username,password)
        except:
            message = 'ERROR: SALTEMAIL -- cannot login to email server ' + server + ' as user ' + username
            status = saltprint.err(logfile,message)

# send emails

    if (status == 0):
        msg = MIMEText(message)
        msg['Subject'] = subject
        msg['From'] = sender
        msg['To'] = recipient
        try:
            smtp.sendmail(sender,recipient,msg.as_string())
        except:
            message = 'ERROR: SALTEMAIL -- failed to send email to ' + recipient
            status = saltprint.err(logfile,message)

# disconnect from email server

    if (status == 0):
        try:
            smtp.quit()
        except:
            message = '\nERROR: SALTEMAIL -- cannot disconnect from email server ' + server
            status = saltprint.err(logfile,message)

    return status
Esempio n. 24
0
def copydir(file1,file2,verbose,logfile):

    status = 0
    message = 'SALTIO.COPYDIR -- copied ' + file1 + ' to ' + file2
    try:
        shutil.copytree(file1,file2)
    except Exception, e:
        message = 'ERROR -- SALTIO.COPYDIR: could not copy %s to %s because %s' % (file1,file2,e)
        status = saltprint.err(logfile,message)
Esempio n. 25
0
def closefits(struct,logfile):

    status = 0
    try:
        struct.close()
    except:
        message = 'ERROR -- SALTIO.CLOSE: Cannot close HDU structure'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 26
0
def writeimage(struct,hdu,imagedata,logfile):

    status = 0
    try:
        struct[hdu].data = imagedata
    except Exception, e:
        message = 'ERROR -- SALTIO.WRITEIMAGE: Cannot write image data to HDU ' + str(hdu)
        message += ' because %s ' % e
        status = saltprint.err(logfile,message)
Esempio n. 27
0
def deletedir(path,logfile):

    status = 0
    try:
        os.rmdir(path)
    except:
        message = 'ERROR -- SALTIO.DELETEDIR: Could not delete directory' + file
        status = saltprint.err(logfile,message)
    return status
Esempio n. 28
0
def listexists(filetype,file,logfile):

    status = 0
    file = file.lstrip('@')
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.LISTEXIST: ' + filetype + ' list '+ file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 29
0
def new(keyword,value,comment,hdu,file,logfile):
    """add new keyword"""

    status = 0
    try:
        hdu.header.update(keyword,value,comment)
    except Exception, e:
        message = 'ERROR -- SALTKEY.NEW: Cannot create keyword %s in %s because %s ' % (keyword, file, e)
        status = saltprint.err(logfile,message)
Esempio n. 30
0
def listexists(filetype,file,logfile):

    status = 0
    file = file.lstrip('@')
    if not os.path.isfile(file):
        message = 'ERROR -- SALTIO.LISTEXIST: ' + filetype + ' list '+ file
        message += ' does not exist'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 31
0
def updatefits(struct,logfile):

    status = 0
    try:
        struct.flush()
    except:
        message = 'ERROR -- SALTIO.UPDATEFITS: cannot update FITS file'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 32
0
def closefits(struct,logfile):

    status = 0
    try:
        struct.close()
    except:
        message = 'ERROR -- SALTIO.CLOSE: Cannot close HDU structure'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 33
0
def updatefits(struct,logfile):

    status = 0
    try:
        struct.flush()
    except:
        message = 'ERROR -- SALTIO.UPDATEFITS: cannot update FITS file'
        status = saltprint.err(logfile,message)
    return status
Esempio n. 34
0
def deletedir(path,logfile):

    status = 0
    try:
        os.rmdir(path)
    except:
        message = 'ERROR -- SALTIO.DELETEDIR: Could not delete directory' + file
        status = saltprint.err(logfile,message)
    return status
Esempio n. 35
0
def delete(file,verbose,logfile):

    status = 0
    message = 'SALTIO.DELETE -- deleted file ' + file
    try:
        os.remove(file)
        saltprint.log(logfile,message,verbose)
    except Exception, e:
        message = 'ERROR -- SALTIO.DELETE: Could not delete %s because %s' % (file ,e)
        status = saltprint.err(logfile,message)
Esempio n. 36
0
def pathexists(path,logfile):

    status = 0
    path = path.strip()
    if (path[-1] != '/'): path += '/'
    if (not os.path.exists(path)):
        message = 'ERROR -- SALTIO.PATHEXISTS: Path ' + path[:-1] + ' does not exist'
        status = saltprint.err(logfile,message)

    return path, status
Esempio n. 37
0
def readimage(struct,hdu,logfile):

    imagedata=[]
    status = 0
    try:
        imagedata = struct[hdu].data
    except:
        message = 'ERROR -- SALTIO.READIMAGE: cannot read image data from HDU ' + str(hdu)
        status = saltprint.err(logfile,message)
    return imagedata, status
Esempio n. 38
0
def pathexists(path,logfile):

    status = 0
    path = path.strip()
    if (path[-1] != '/'): path += '/'
    if (not os.path.exists(path)):
        message = 'ERROR -- SALTIO.PATHEXISTS: Path ' + path[:-1] + ' does not exist'
        status = saltprint.err(logfile,message)

    return path, status
Esempio n. 39
0
def filenumber(filename):

    status = 0
    try:
        fileno = int(filename.rstrip()[9:-5])
    except:
        message = 'ERROR: SALTSTRING.FILENUMBER -- could not extract file number from filename' + filename
        status = saltprint.err(logfile,message)

    return fileno, status
Esempio n. 40
0
def overwrite(file,clobber,logfile):

    status = 0
    if (os.path.isfile(file) and clobber):
        status = delete(file,False,logfile)
    elif (os.path.isfile(file) and not clobber):
        message = 'ERROR: SALTIO.OVERWRITE -- file ' + file + ' exists. use clobber=y'
        status = saltprint.err(logfile,message)

    return status
Esempio n. 41
0
def newfitstable(table,file,logfile):

    struct=''
    status = 0
    try:
        struct = pyfits.new_table(table)
    except:
        message = 'ERROR -- SALTIO.NEWFITSTABLE: cannot create new table in ' + file
        status = saltprint.err(logfile,message)
    return struct, status
Esempio n. 42
0
def fitscolumns(columns,file,logfile):

    table=''
    status = 0
    try:
        table = pyfits.ColDefs(columns)
    except:
        message = 'ERROR -- SALTIO.FITSCOLUMNS: cannot define table columns in ' + file
        status = saltprint.err(logfile,message)
    return table, status
Esempio n. 43
0
def readtab(hdu,file,logfile):

    table=''
    status = 0
    message = 'ERROR -- SALTIO.READTAB: could not extract table from ' + file
    try:
        table = hdu.data
    except:
        status = saltprint.err(logfile,message)
    return table, status
Esempio n. 44
0
def readimage(struct,hdu,logfile):

    imagedata=[]
    status = 0
    try:
        imagedata = struct[hdu].data
    except:
        message = 'ERROR -- SALTIO.READIMAGE: cannot read image data from HDU ' + str(hdu)
        status = saltprint.err(logfile,message)
    return imagedata, status
Esempio n. 45
0
def overwrite(file,clobber,logfile):

    status = 0
    if (os.path.isfile(file) and clobber):
        status = delete(file,False,logfile)
    elif (os.path.isfile(file) and not clobber):
        message = 'ERROR: SALTIO.OVERWRITE -- file ' + file + ' exists. use clobber=y'
        status = saltprint.err(logfile,message)

    return status
Esempio n. 46
0
def newfitstable(table,file,logfile):

    struct=''
    status = 0
    try:
        struct = pyfits.new_table(table)
    except:
        message = 'ERROR -- SALTIO.NEWFITSTABLE: cannot create new table in ' + file
        status = saltprint.err(logfile,message)
    return struct, status
Esempio n. 47
0
def fitscolumns(columns,file,logfile):

    table=''
    status = 0
    try:
        table = pyfits.ColDefs(columns)
    except:
        message = 'ERROR -- SALTIO.FITSCOLUMNS: cannot define table columns in ' + file
        status = saltprint.err(logfile,message)
    return table, status
Esempio n. 48
0
def readtab(hdu,file,logfile):

    table=''
    status = 0
    message = 'ERROR -- SALTIO.READTAB: could not extract table from ' + file
    try:
        table = hdu.data
    except:
        status = saltprint.err(logfile,message)
    return table, status
Esempio n. 49
0
def closeascii(infile,logfile):

    status = 0
    try:
        infile.close()
    except:
        message = 'ERROR: SALTIO.CLOSEASCII -- Cannot close ASCII file ' + infile
        status = saltprint.err(logfile,message)

    return status
Esempio n. 50
0
def closeascii(infile,logfile):

    status = 0
    try:
        infile.close()
    except:
        message = 'ERROR: SALTIO.CLOSEASCII -- Cannot close ASCII file ' + infile
        status = saltprint.err(logfile,message)

    return status
Esempio n. 51
0
def filedoesnotexist(file,verbose,logfile):

    status = 0
    if os.path.isfile(file):
        if (verbose == 'no'):
            status = 1
        else:
            message = 'ERROR -- SALTIO.FILEDOESNOTEXIST: File ' + file
            message += ' already exists'
            status = saltprint.err(logfile,message)
    return status
Esempio n. 52
0
def openascii(file,type,logfile):

    content=[]
    status = 0
    try:
        content = open(file,type)
    except:
        message = 'ERROR: SALTIO.OPENASCII -- Cannot open ASCII file ' + file
        status = saltprint.err(logfile,message)

    return content, status
Esempio n. 53
0
def openascii(file,type,logfile):

    content=[]
    status = 0
    try:
        content = open(file,type)
    except:
        message = 'ERROR: SALTIO.OPENASCII -- Cannot open ASCII file ' + file
        status = saltprint.err(logfile,message)

    return content, status