exit()
or quit()
detected PYL-R1722168 print(f"\tUpdated = {config['macros'][arguments['<name>']]['updated']}")
169 if config['macros'][arguments['<name>']].get("last_run", False):
170 print(f"\tLast Run = {config['macros'][arguments['<name>']]['last_run']}")
171 exit()172 except KeyError:
173 ... # If the command is not registered, do nothing and let the dispatch spellchecker find it
174 if not arguments['<paths>'] and not arguments['<command>']:
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.