def run_vistrails_locally_file(path_to_vistrails, path_to_python,
                               env_for_vistrails, filename, 
                               version, path_to_figures, build_always=False,
                               tag='', execute=False, showspreadsheetonly=False,
                               pdf=False, embedWorkflow=False, 
                               includeFullTree=False):
    v = version
    if tag != '':
        v = tag
    cmd_line = build_vistrails_cmd_line_file(path_to_vistrails, path_to_python, 
                                             env_for_vistrails,
                                             filename, v, path_to_figures, 
                                             pdf)
    log("run_vistrails_locally_file")
    log("cmdline: %s"%cmd_line)
    if build_always:
        #force to remove the folder so we avoid stale results
        if os.path.exists(path_to_figures):
            shutil.rmtree(path_to_figures)
            
    if not os.path.exists(path_to_figures):
        log("creating image path")
        os.makedirs(path_to_figures)
                
    if build_always or not path_exists_and_not_empty(path_to_figures):
        my_env = os.environ
        sep = ":"
        if systemType in ["Windows", "Microsoft"]:
            sep = ";"
        if env_for_vistrails != '':
            data = shlex.split(env_for_vistrails)
            log("env_for_vistrails: %s"%data)
            for d in data:
                (name,val) = d.split("=")
                pos = val.find("$"+name)
                if pos != -1:
                    if pos == 0:
                        my_env[name] = my_env.get(name,'') + \
                                       val[pos+len(name)+1:]
                    else:
                        if pos + len(name) == len(val) -1:
                            my_env[name] = val[0:pos] + my_env.get(name,'')
                        else:
                            my_env[name] = val[0:pos] + my_env.get(name,'') + \
                                           val[pos+len(name)+1:]
                else:
                    my_env[name] = val
        log("env: %s"%my_env)
        if systemType in ['Windows', 'Microsoft']:
            proc = subprocess.Popen(cmd_line,
                                    env=my_env,
                                    stdout=subprocess.PIPE)
        else:
            proc = subprocess.Popen(cmd_line, shell=False,
                                    env=my_env,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    close_fds=True)
        proc.wait()
        log("result: %s"%proc.returncode)
        if proc.stdout:
            lines = proc.stdout.readlines()
            log("stdout: %s"%lines)
        if proc.returncode != 0:
            shutil.rmtree(path_to_figures)
            msg = "See vistrails.log for more information."
            return (False, generate_latex_error(msg))
    log("will generate latex")
    try:
        return (True, generate_latex_file(os.path.dirname(os.path.abspath(filename)), 
                                      filename, version, tag,
                                      execute, showspreadsheetonly,
                                      path_to_figures, graphics_options,
                                      embedWorkflow, includeFullTree))
    except Exception, e:
        log("Error: %s"%str(e))
###############################################################################
Handles POST requests, instantiating a form instance with the passed
dataset/ETHPy150Open VisTrails/VisTrails/extensions/latex/includevistrail.py/run_vistrails_locally_file--crossover with--dataset/ETHPy150Open upconsulting/IsisCB/isiscb/isisdata/views.py/UserRegistrationView.post