Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(configbase, filebase, options, progname):
"""
Access input file as grid, and generate Minim
"""
status = 0
# open spreadsheet file as grid
log.debug("%s: open grid %s"%(progname, options.checklist))
gridfilename = os.path.join(filebase,options.checklist)
log.debug("CSV file: %s"%gridfilename)
base = ""
if gridfilename.endswith(".csv"):
try:
with open(gridfilename, "rU") as csvfile:
grid = GridCSV(csvfile, baseuri="", dialect=csv.excel)
except IOError, e:
print "Failed to open grid CSV file %s"%(e)
return 2
elif gridfilename.endswith(".xls"):
try:
grid = GridExcel(gridfilename, baseuri="")
except IOError, e:
print "Failed to open grid XLS file %s"%(e)
return 2
else:
print "Unrecognized grid file type %s; must be CSV or XLS."%(gridfilename)
return 2
# Make minim file
log.debug("mkminim %s"%(repr(options)))
(status, mgr) = mkminim(grid, baseuri=grid.resolveUri(""))
# Serialize graph to output stream