def readChecksums(fileIn):
# Read checksum file, return contents as nested list
# Also strip away any file paths if they exist (return names only)
try:
data = []
f = open(fileIn,"r", encoding="utf-8")
for row in f:
rowSplit = row.split(' ', 1)
# Second col contains file name. Strip away any path components if they are present
fileName = rowSplit[1].strip() # Raises IndexError if entry only 1 col (malformed checksum file)!
rowSplit[1] = os.path.basename(fileName)
data.append(rowSplit)
f.close()
return(data)
except IOError:
logging.fatal("cannot read '" + fileIn + "'")
config.errors += 1
errorExit(config.errors, config.warnings)
评论列表
文章目录