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