From 7ad45c61b512bf879a7e2128ead5f409026ad2ec Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Tue, 7 May 2024 17:45:29 +0100 Subject: [PATCH] Check that pdf output file exists in genealogy tree reports Fixes #10696 --- gramps/gen/plug/docgen/treedoc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gramps/gen/plug/docgen/treedoc.py b/gramps/gen/plug/docgen/treedoc.py index 2519be716d7..88fd30dfa92 100644 --- a/gramps/gen/plug/docgen/treedoc.py +++ b/gramps/gen/plug/docgen/treedoc.py @@ -45,6 +45,7 @@ from ..menu import NumberOption, TextOption, EnumeratedListOption from ...constfunc import win from ...config import config +from ...errors import ReportError from ...const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -815,7 +816,14 @@ def close(self): else: proc = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) proc.communicate(input=self._tex.getvalue().encode("utf-8")) - shutil.copy(os.path.join(tmpdir, basename), self._filename) + + temp_output_file = os.path.join(tmpdir, basename) + if os.path.isfile(temp_output_file): + shutil.copy(temp_output_file, self._filename) + else: + raise ReportError( + _("Empty report"), _("Could not create %s") % self._filename + ) # ------------------------------------------------------------------------------