replace exit() and quit() with sys.exit()

This commit is contained in:
noelle 2025-06-01 21:32:47 -04:00
parent 7a74050c5d
commit 4cc4b2ead4
Signed by: noelle
SSH Key Fingerprint: SHA256:30qkkOn+Czx9ud36Ekl0NB/y+W4c25oREt+qmasrU9w

View File

@ -129,7 +129,7 @@ def test_user_car():
except:
print("ERROR: Couldn't open " + fname)
print("Either it doesn't exist, or is not readble by the tilde.train script.")
exit()
sys.exit(1)
choochoo_string = myfile.read()
choochoo_list = choochoo_string.split("\n")
@ -166,7 +166,7 @@ def test_user_car():
print(string.printable.strip())
print("")
print("Yours contained " + bad_chars)
exit()
sys.exit(1)
# print("")
# print("Test results:")
@ -178,17 +178,17 @@ def test_user_car():
print("FAIL. Your train car is too tall.")
print("It should be no taller than " + str(max_y) + " lines in height.")
myfile.close()
exit()
sys.exit(1)
if train_length > max_x:
print("FAIL. Your train car is too long.")
print("It should be no longer than " + str(max_x) + " characters in length.")
myfile.close()
exit()
sys.exit(1)
print("PASS. Your train car will work on the tilde.town tracks! :)")
myfile.close()
exit()
sys.exit()
def link_car(car):
for idx,row in enumerate(car):
@ -302,24 +302,24 @@ def chuggachugga(stdscr):
def handler(signal_received, frame):
print("Oops. The train broke. The engineer is looking into it!")
print("(Note: the train does not work in all terminals yet.)")
exit(0)
sys.exit(1)
default_car = validate_car(default_car)
if len(sys.argv) == 2 and ("-h" in sys.argv[1] or "help" in sys.argv[1]):
print_help()
quit()
sys.exit()
if len(sys.argv) == 2 and ("-t" in sys.argv[1] or "test" in sys.argv[1]):
test_user_car()
quit()
sys.exit()
if len(sys.argv) == 2 and ("-p" in sys.argv[1] or "print" in sys.argv[1]):
print_train = True
if len(sys.argv) == 2 and ("-a" in sys.argv[1] or "all" in sys.argv[1]):
print_all_cars()
quit()
sys.exit()
## start a loop that collects all .choochoo files and processes on in each loop
@ -368,7 +368,7 @@ if print_train:
print("<pre>")
print(train_str)
print("</pre>")
quit()
sys.exit()
pad_str = " "*train_len
train.insert(0,pad_str)