容忍tex文件的缺失

This commit is contained in:
binary-husky
2023-10-22 00:05:48 +08:00
parent b88e577eb5
commit a14ef78d52
2 changed files with 16 additions and 13 deletions

View File

@@ -308,7 +308,10 @@ def merge_tex_files_(project_foler, main_file, mode):
fp = os.path.join(project_foler, f)
fp_ = find_tex_file_ignore_case(fp)
if fp_:
with open(fp_, 'r', encoding='utf-8', errors='replace') as fx: c = fx.read()
try:
with open(fp_, 'r', encoding='utf-8', errors='replace') as fx: c = fx.read()
except:
c = f"\n\nWarning from GPT-Academic: LaTex source file is missing!\n\n"
else:
raise RuntimeError(f'找不到{fp}Tex源文件缺失')
c = merge_tex_files_(project_foler, c, mode)