exit()
or quit()
detected PYL-R1722223
224else:
225 print("You have to type an operation!?")
226 exit()
127 float(function[2])
128 except:
129 print("Enter a valid function try again. ")
130 exit()131
132 x = float(function[2])*x
133 posOfX = function.rfind('x')
108 ys.append(y_value)
109 else:
110 print("Enter a valid function try again! ")
111 exit()112
113 def operatorReaction2(x):
114 if function[index] in multiplication:
87
88 except:
89 print("Enter a valid function try again ")
90 exit() 91
92 index = 2
93 i = 0
52 data_point_y = float(data_point_y)
53 except ValueError:
54 print("You have to type a number!")
55 exit() 56
57 data_point_list_y.append(data_point_y)
58 stop1 = input("Press enter to continue or done to stop...")
The exit
or quit
functions don't exist at top-level if python is started with the -S
flag, and will raise an error. Use sys.exit()
instead.
The exit
and quit
functions are actually site.Quitter
objects and are loaded, at interpreter start up, from site.py
.
However, if the interpreter is started with the -S
flag, or a custom site.py
is used then exit
and quit
may not be present.
It is recommended to use sys.exit()
which is built into the interpreter and is guaranteed to be present.
try:
patch_diffs()
except Exception as exc:
print(exc)
exit(1)
Here, exit()
is used and will fail if the python is run with the -S
option.
import sys
try:
patch_diffs()
except Exception as exc:
print(exc)
sys.exit(1)
sys.exit()
is guaranteed to work, regardless of the interpreter options.