run.append(output_fp) subprocess.Popen(run) else: if start >= 1: debug_file.write("Starting "+str(viewer)) run=[viewer] run.extend(viewer_opt) run.append(output_fp) with open(os.devnull, "w+") as devnull: subprocess.Popen(run, stdout=devnull, stderr=subprocess.STDOUT) if start == 2: debug_file.write("SyncTex with "+str(viewer)) vim_remote_expr(servername, "atplib#SyncTex()") copy_back(tmpdir, latex.returncode) except Exception: error_str=re.sub("'", "''",re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) vim_remote_expr(servername, "atplib#callback#Echo(\"[ATP:] error in makelatex.py, catched python exception:\n"+error_str+"[ATP info:] this error message is recorded in makelatex.log under g:atp_TempDir\",'echo','ErrorMsg')") # Rewrite the LaTeX log file. latex_log.rewrite_log(logfile, check_path=True, project_dir=texfile_dir, project_tmpdir=tmpdir) debug_file.write("PIDS="+str(pids)) vim_remote_expr(servername, "atplib#callback#Echo('[ATP:] MakeLatex finished.', 'echomsg', 'Normal')") if did_bibtex and bibtex_returncode != 0: vim_remote_expr(servername, "atplib#callback#Echo('[MakeLatex:] bibtex returncode "+str(bibtex_returncode)+".', 'echo', 'Normal')") if did_makeidx and index_returncode != 0: vim_remote_expr(servername, "atplib#callback#Echo('[MakeLatex:] makeidx returncode "+str(index_returncode)+".', 'echo', 'Normal')") vim_remote_expr(servername, "atplib#callback#CallBack('"+str(bufnr)+"','"+str(options.verbose)+"','COM','"+str(did_bibtex)+"','"+str(did_makeidx)+"')") sys.exit(latex.returncode)
viewer_s = subprocess.Popen(run) debug_file.write("D2: " + str(['xpdf', '-remote', XpdfServer, '-reload']) + "\n") else: if start >= 1: run = [viewer] run.extend(viewer_opt) run.append(output_fp) print(run) debug_file.write("RUN {}\n".format(run)) subprocess.Popen(run, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if start == 2: vim_remote_expr(servername, "atplib#SyncTex()") # Rewrite LaTeX log file latex_log.rewrite_log("{}.log".format(os.path.splitext(output_fp)[0]), check_path=True, project_dir=mainfile_dir, project_tmpdir=tmpdir) #################################### # # Clean: # #################################### except Exception: latex_returncode = 0 error_str = re.sub("'", "''", re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) if options.callback: vim_remote_expr(servername, "atplib#callback#Echo(\"[ATP:] error in compile.py, catched python exception:\n{}\n[ATP info:] this error message is recorded in compile.py.log under g:atp_TempDir\",'echo','ErrorMsg')".format(error_str)) else: print(error_str)
viewer_s = subprocess.Popen(run) debug_file.write("D2: " + str(["xpdf", "-remote", XpdfServer, "-reload"]) + "\n") else: if start >= 1: run = [viewer] run.extend(viewer_opt) run.append(output_fp) print(run) debug_file.write("RUN " + str(run) + "\n") subprocess.Popen(run, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if start == 2: vim_remote_expr(servername, "atplib#SyncTex()") # Rewrite LaTeX log file latex_log.rewrite_log( os.path.splitext(mainfile_fp)[0] + ".log", check_path=True, project_dir=mainfile_dir, project_tmpdir=tmpdir ) #################################### # # Clean: # #################################### except Exception: latex_returncode = 0 error_str = re.sub("'", "''", re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) if options.callback: vim_remote_expr( servername, 'atplib#callback#Echo("[ATP:] error in compile.py, catched python exception:\n'
subprocess.Popen(run, stdout=devnull, stderr=subprocess.STDOUT) if start == 2: debug_file.write("SyncTex with " + str(viewer)) vim_remote_expr(servername, "atplib#SyncTex()") copy_back(tmpdir, latex.returncode) except Exception: error_str = re.sub("'", "''", re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) vim_remote_expr( servername, "atplib#callback#Echo(\"[ATP:] error in makelatex.py, catched python exception:\n{}[ATP info:] this error message is recorded in makelatex.log under g:atp_TempDir\",'echo','ErrorMsg')" .format(error_str)) # Rewrite the LaTeX log file. latex_log.rewrite_log(os.path.join(outdir, logfile), check_path=True, project_dir=texfile_dir, project_tmpdir=tmpdir) debug_file.write("PIDS={}".format(pids)) vim_remote_expr( servername, "atplib#callback#Echo('[ATP:] MakeLatex finished.', 'echomsg', 'Normal')") if did_bibtex and bibtex_returncode != 0: vim_remote_expr( servername, "atplib#callback#Echo('[MakeLatex:] bibtex returncode {}.', 'echo', 'Normal')" .format(bibtex_returncode)) if did_makeidx and index_returncode != 0: vim_remote_expr( servername, "atplib#callback#Echo('[MakeLatex:] makeidx returncode {}.', 'echo', 'Normal')"
run.append(output_fp) subprocess.Popen(run) else: if start >= 1: debug_file.write("Starting "+str(viewer)) run=[viewer] run.extend(viewer_opt) run.append(output_fp) with open(os.devnull, "w+") as devnull: subprocess.Popen(run, stdout=devnull, stderr=subprocess.STDOUT) if start == 2: debug_file.write("SyncTex with "+str(viewer)) vim_remote_expr(servername, "atplib#SyncTex()") copy_back(tmpdir, latex.returncode) except Exception: error_str=re.sub("'", "''",re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) vim_remote_expr(servername, "atplib#callback#Echo(\"[ATP:] error in makelatex.py, catched python exception:\n"+error_str+"[ATP info:] this error message is recorded in makelatex.log under g:atp_TempDir\",'echo','ErrorMsg')") # Rewrite the LaTeX log file. latex_log.rewrite_log(os.path.join(outdir,logfile), check_path=True, project_dir=texfile_dir, project_tmpdir=tmpdir) debug_file.write("PIDS="+str(pids)) vim_remote_expr(servername, "atplib#callback#Echo('[ATP:] MakeLatex finished.', 'echomsg', 'Normal')") if did_bibtex and bibtex_returncode != 0: vim_remote_expr(servername, "atplib#callback#Echo('[MakeLatex:] bibtex returncode "+str(bibtex_returncode)+".', 'echo', 'Normal')") if did_makeidx and index_returncode != 0: vim_remote_expr(servername, "atplib#callback#Echo('[MakeLatex:] makeidx returncode "+str(index_returncode)+".', 'echo', 'Normal')") vim_remote_expr(servername, "atplib#callback#CallBack('"+str(bufnr)+"','"+str(options.verbose)+"','COM','"+str(did_bibtex)+"','"+str(did_makeidx)+"')") sys.exit(latex.returncode)
else: if start >= 1: run = [viewer] run.extend(viewer_opt) run.append(output_fp) print(run) debug_file.write("RUN {}\n".format(run)) subprocess.Popen(run, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if start == 2: vim_remote_expr(servername, "atplib#SyncTex()") # Rewrite LaTeX log file latex_log.rewrite_log("{}.log".format(os.path.splitext(output_fp)[0]), check_path=True, project_dir=mainfile_dir, project_tmpdir=tmpdir) #################################### # # Clean: # #################################### except Exception: latex_returncode = 0 error_str = re.sub("'", "''", re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) if options.callback: vim_remote_expr( servername, "atplib#callback#Echo(\"[ATP:] error in compile.py, catched python exception:\n{}\n[ATP info:] this error message is recorded in compile.py.log under g:atp_TempDir\",'echo','ErrorMsg')"
debug_file.write("SyncTex with " + str(viewer)) vim_remote_expr(servername, "atplib#SyncTex()") copy_back(tmpdir, latex.returncode) except Exception: error_str = re.sub("'", "''", re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) vim_remote_expr( servername, "atplib#callback#Echo(\"[ATP:] error in makelatex.py, catched python exception:\n" + error_str + "[ATP info:] this error message is recorded in makelatex.log under g:atp_TempDir\",'echo','ErrorMsg')" ) # Rewrite the LaTeX log file. latex_log.rewrite_log(logfile, check_path=True, project_dir=texfile_dir, project_tmpdir=tmpdir) debug_file.write("PIDS=" + str(pids)) vim_remote_expr( servername, "atplib#callback#Echo('[ATP:] MakeLatex finished.', 'echomsg', 'Normal')") if did_bibtex and bibtex_returncode != 0: vim_remote_expr( servername, "atplib#callback#Echo('[MakeLatex:] bibtex returncode " + str(bibtex_returncode) + ".', 'echo', 'Normal')") if did_makeidx and index_returncode != 0: vim_remote_expr( servername, "atplib#callback#Echo('[MakeLatex:] makeidx returncode " + str(index_returncode) + ".', 'echo', 'Normal')") vim_remote_expr(
run=['xpdf', '-remote', XpdfServer, '-reload'] viewer_s=subprocess.Popen(run) debug_file.write("D2: "+str(['xpdf', '-remote', XpdfServer, '-reload'])+"\n") else: if start >= 1: run=[viewer] run.extend(viewer_opt) run.append(output_fp) print(run) debug_file.write("RUN "+str(run)+"\n") subprocess.Popen(run, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if start == 2: vim_remote_expr(servername, "atplib#SyncTex()") # Rewrite LaTeX log file latex_log.rewrite_log(os.path.splitext(mainfile_fp)[0]+".log", check_path=True, project_dir=mainfile_dir, project_tmpdir=tmpdir) #################################### # # Clean: # #################################### except Exception: latex_returncode = 0 error_str=re.sub("'", "''",re.sub('"', '\\"', traceback.format_exc())) traceback.print_exc(None, debug_file) if options.callback: vim_remote_expr(servername, "atplib#callback#Echo(\"[ATP:] error in compile.py, catched python exception:\n"+error_str+"[ATP info:] this error message is recorded in compile.py.log under g:atp_TempDir\",'echo','ErrorMsg')") else: print(error_str)