try:
hr, buffer = win32file.ReadFile(stdout_r, 4096)
if hr != winerror.ERROR_IO_PENDING:
- data = data + buffer
+ data = data + str(buffer)
except pywintypes.error as e:
if e.args[0] != winerror.ERROR_BROKEN_PIPE:
latex_status, latex_stdout = run_tex(latex, latex_file)
# Rerun latex if necessary
progress("Checking if a latex rerun is necessary")
- if string_in_file("Warning: Citation", log_file):
+ if string_in_file("Warning: (Citation|Reference)", log_file):
latex_status, latex_stdout = run_tex(latex, latex_file)
return latex_status, latex_stdout
def run_tex(tex, tex_file):
- tex_call = '%s "%s"' % (tex, tex_file)
+ tex_call = f'{tex} "{tex_file}"'
tex_status, tex_stdout = run_command(tex_call)
if tex_status:
def string_in_file(string, infile):
if not os.path.isfile(infile):
return False
+ string_re = re.compile(string.encode())
f = open(infile, 'rb')
for line in f.readlines():
- if string.encode() in line:
+ if string_re.search(line):
f.close()
return True
f.close()
found_error = False
match = data_re.search(line)
if match == None:
- error("Unexpected data in %s\n%s" % (log_file, line))
+ error(f"Unexpected data in {log_file}\n{line}")
error_pages.append(int(match.group(1)))