def get_vt_graph_locally_file(path_to_vistrails, path_to_python,
                              env_for_vistrails, filename,
                              path_to_figures, build_always=False, pdf=False,
                              embedWorkflow=False, includeFullTree=False):
    cmd_line = build_vistrails_cmd_line_file(path_to_vistrails, 
                                             path_to_python,
                                             env_for_vistrails, 
                                             filename, None, path_to_figures, 
                                             pdf, False, True)
    log("get_vt_graph_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 images folder")
        os.makedirs(path_to_figures)
        
    if build_always or not path_exists_and_not_empty(path_to_figures):
        log("  folder was empty or forcing execution")
        my_env = os.environ
        sep = ":"
        if systemType in ["Windows", "Microsoft"]:
            sep = ";"
        if env_for_vistrails != '':
            data = shlex.split(env_for_vistrails)
            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:
            os.rmdir(path_to_figures)
            msg = "See vistrails.log and vistrails_run.log for more information."
            return (False, generate_latex_error(msg))
    else:
        log("  found cached images")
        
    return (True, generate_latex_file(os.path.dirname(os.path.abspath(filename)), 
                                      filename, None, '', False, 
                                      False, path_to_figures, 
                                      graphics_options, embedWorkflow, 
                                      includeFullTree))    

###############################################################################
Recommend up to max_items most highly recommended items for user u.
dataset/ETHPy150Open VisTrails/VisTrails/extensions/latex/includevistrail.py/get_vt_graph_locally_file--crossover with--dataset/ETHPy150Open Mendeley/mrec/mrec/mf/recommender.py/MatrixFactorizationRecommender.recommend_items