Skip to content

Commit b8524a9

Browse files
committed
book index file check
1 parent fa2e1c7 commit b8524a9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

deployment/installtutorials.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ def process_repo(repo, destination_directory):
6666
destination_directory,
6767
)
6868
if len(tutorials) > 1:
69-
index = glob.glob(f"{repo}/index-*.html")[0]
70-
print(f"More than 1 tutorial found; also copying index file {index}")
71-
shutil.copy(index, destination_directory)
69+
index_files = glob.glob(f"{repo}/index-*.html")
70+
if index_files:
71+
index = index_files[0]
72+
print(f"More than 1 tutorial found; also copying index file {index}")
73+
shutil.copy(index, destination_directory)
74+
else:
75+
raise FileNotFoundError(f"No index-*.html file found for {repo_name}.")
76+
7277
# copy images (plots) in notebook for faster page loading
7378
images = glob.glob(f"{repo}/_images/*.png")
7479
if len(images) > 0:

0 commit comments

Comments
 (0)