Skip to content

Commit

Permalink
Check that pdf output file exists in genealogy tree reports
Browse files Browse the repository at this point in the history
Fixes #10696
  • Loading branch information
Nick-Hall committed Jul 8, 2024
1 parent d8a3982 commit 7ad45c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gramps/gen/plug/docgen/treedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)


# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 7ad45c6

Please sign in to comment.