Skip to content

Commit

Permalink
Don't die if template path cannot be read (#2162)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuaxo authored Aug 7, 2024
1 parent 9c65025 commit 55ff3e9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions nbconvert/exporters/templateexporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,13 +565,19 @@ def _template_paths(self, prune=True, root_dirs=None):
for template_name in template_names:
for base_dir in self.extra_template_basedirs:
path = os.path.join(base_dir, template_name)
if not prune or os.path.exists(path):
paths.append(path)
try:
if not prune or os.path.exists(path):
paths.append(path)
except PermissionError:
pass
for root_dir in root_dirs:
base_dir = os.path.join(root_dir, "nbconvert", "templates")
path = os.path.join(base_dir, template_name)
if not prune or os.path.exists(path):
paths.append(path)
try:
if not prune or os.path.exists(path):
paths.append(path)
except PermissionError:
pass

for root_dir in root_dirs:
# we include root_dir for when we want to be very explicit, e.g.
Expand Down

0 comments on commit 55ff3e9

Please sign in to comment.