Skip to content

Commit

Permalink
fix: A minor fix to escape an error when a user selects a wrong item …
Browse files Browse the repository at this point in the history
…number.

Change-Id: I57aaaf8b71df7c950a8f0199fd4b539f81ea2528
  • Loading branch information
Kacper Krasowiak committed Jul 19, 2024
1 parent 3b52fd2 commit f39bca3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ariel/dubbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,12 +854,15 @@ def _select_edit_number(
"""Runs edit index selection process."""
ask_for_index = True
while ask_for_index:
index = int(input("Enter item number to edit: ")) - 1
if not 0 <= index < len(utterance_metadata):
print("Invalid item number.")
else:
ask_for_index = False
return index
try:
index = int(input("Enter item number to edit: ")) - 1
if not 0 <= index < len(utterance_metadata):
print("Invalid item number.")
else:
ask_for_index = False
return index
except ValueError:
print("Invalid input format. Please try again.")

def _edit_utterance_metadata(
self,
Expand Down

0 comments on commit f39bca3

Please sign in to comment.