From aa952590639e7e694ed24e673368d55eaea700f8 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Sun, 23 Aug 2020 23:40:22 +0200 Subject: Made O/C/U choice mandatory --- filmstripper.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/filmstripper.py b/filmstripper.py index 98a16fc..e36c3a3 100644 --- a/filmstripper.py +++ b/filmstripper.py @@ -43,18 +43,25 @@ else: outputFile = "output/output.png" if path.isfile(outputFile): - print("WARNING: Output file already exists. What would you like to do? Overwrite, Cancel or Unique?") - answer = input("[O/C/U]: ") - if answer == "O" or answer == "o": - None - elif answer == "C" or answer == "c": - broke = True - elif answer == "U" or answer == "u": - while path.isfile(outputFile): - index = outputFile.find(".") - newName = outputFile[:index] + str(random.randint(0, 9)) + outputFile[index:] - print("New output filename: "+newName) - outputFile = newName + name_conflict = True + while name_conflict: + print("WARNING: Output file already exists. What would you like to do? Overwrite, Cancel or Unique?") + answer = input("[O/C/U]: ") + if answer == "O" or answer == "o": + None + name_conflict = False + elif answer == "C" or answer == "c": + broke = True + name_conflict = False + elif answer == "U" or answer == "u": + while path.isfile(outputFile): + index = outputFile.find(".") + newName = outputFile[:index] + str(random.randint(0, 9)) + outputFile[index:] + print("New output filename: "+newName) + outputFile = newName + name_conflict = False + else: + print("Please write O, C or U.") brkck() -- cgit v1.2.1