Changed code to be python < 3.6 compatible

This commit is contained in:
Eric Lapouyade 2021-10-01 12:20:46 +02:00
parent 541d5ce7cb
commit 5dfe448a9a
2 changed files with 3 additions and 2 deletions

View File

@ -65,7 +65,8 @@ def check_exists_ask_overwrite(arg_value, overwrite):
# confirmed returns True, else raises FileExistsError. # confirmed returns True, else raises FileExistsError.
if os.path.exists(arg_value) and not overwrite: if os.path.exists(arg_value) and not overwrite:
try: try:
if input('File %s already exists, would you like to overwrite the existing file? (y/n)' % arg_value).lower() == 'y': msg = 'File %s already exists, would you like to overwrite the existing file? (y/n)' % arg_value
if input(msg).lower() == 'y':
return True return True
else: else:
raise FileExistsError raise FileExistsError

View File

@ -16,4 +16,4 @@ print('Executing "%s" ...' % cmd)
os.system(cmd) os.system(cmd)
if os.path.exists(OUTPUT_FILENAME): if os.path.exists(OUTPUT_FILENAME):
print(f' --> File %s has been generated.' % OUTPUT_FILENAME) print(' --> File %s has been generated.' % OUTPUT_FILENAME)