From 974251a97efec428ad8634de1722f37bb9fd20ad Mon Sep 17 00:00:00 2001 From: Matistjati Date: Sun, 5 Apr 2026 18:25:15 +0200 Subject: [PATCH] Remove ghostscript message when converting PDFs --- problemtools/ProblemPlasTeX/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/problemtools/ProblemPlasTeX/__init__.py b/problemtools/ProblemPlasTeX/__init__.py index b136ab7a..a7da5e09 100644 --- a/problemtools/ProblemPlasTeX/__init__.py +++ b/problemtools/ProblemPlasTeX/__init__.py @@ -59,9 +59,9 @@ def getImage(self, node): newext = self.imageConversion[oldext][0] path = os.path.splitext(path)[0] + newext cmd = self.imageConversion[oldext][1] + [path, name] - status = subprocess.call(cmd) - if status: - log.warning('Failed to convert %s image "%s to %s', oldext, name, newext) + result = subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) + if result.returncode: + log.error(f'Failed to convert {oldext} image {name} to {newext}.\n{result.stderr.decode(errors="replace")}') else: # Just copy it path = os.path.splitext(path)[0] + oldext