diff --git a/gramps/gui/plug/report/_reportdialog.py b/gramps/gui/plug/report/_reportdialog.py index 56994e81f..37252bf85 100644 --- a/gramps/gui/plug/report/_reportdialog.py +++ b/gramps/gui/plug/report/_reportdialog.py @@ -527,13 +527,20 @@ class ReportDialog(ManagedWindow): # we will need to create the file/dir # need to make sure we can create in the parent dir parent_dir = os.path.dirname(os.path.normpath(self.target_path)) - if not os.access(parent_dir, os.W_OK): - ErrorDialog(_('Permission problem'), - _("You do not have permission to create " - "%s\n\n" - "Please select another path or correct " - "the permissions.") % self.target_path - ) + if os.path.isdir(parent_dir): + if not os.access(parent_dir, os.W_OK): + ErrorDialog(_('Permission problem'), + _("You do not have permission to create " + "%s\n\n" + "Please select another path or correct " + "the permissions.") % self.target_path + ) + return None + else: + ErrorDialog(_('No directory'), + _('There is no directory %s.\n\n' + 'Please select another directory ' + 'or create it.') % parent_dir ) return None self.set_default_directory(os.path.dirname(self.target_path) + os.sep) diff --git a/gramps/plugins/export/exportxml.py b/gramps/plugins/export/exportxml.py index c27769f93..5ec3bc314 100644 --- a/gramps/plugins/export/exportxml.py +++ b/gramps/plugins/export/exportxml.py @@ -140,6 +140,12 @@ class GrampsXmlWriter(UpdateCallback): "Please make sure you have write access to the " "directory and try again.")) return 0 + else: + raise DbWriteFailure(_('No directory'), + _('There is no directory %s.\n\n' + 'Please select another directory ' + 'or create it.') % base ) + return 0 if os.path.exists(filename): if not os.access(filename, os.W_OK):