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.