Suppress duplicate error messages from Ghostscript

This commit is contained in:
James R. Barlow
2019-12-06 15:14:15 -08:00
parent 17d97b354a
commit cac4a8b9b6
+11 -1
View File
@@ -313,7 +313,17 @@ def generate_pdfa(
else:
stderr = p.stderr.decode('utf-8', errors='replace')
if _gs_error_reported(stderr):
log.error(stderr)
last_part = None
repcount = 0
for part in p.stdout.split('****'):
if part != last_part:
if repcount > 1:
log.error(f"(previous error message repeated {repcount} times)")
repcount = 0
log.error(part)
else:
repcount += 1
last_part = part
elif 'overprint mode not set' in stderr:
# Unless someone is going to print PDF/A documents on a
# magical sRGB printer I can't see the removal of overprinting