How to use the checklist.grid.GridCSV function in checklist

To help you get started, we’ve selected a few checklist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wf4ever / ro-manager / src / checklist / mkminim.py View on Github external
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