There is a huge difference.
sys.exit()throws an exception SystemExitthat Python always catches and turns into program exit code.
Raising ValueError, if not displayed, starts the handler sys.excepthook(), after which Python exits. The default value, except for hook, prints the exception trace before stderr, after which Python completes the exit code from 1.
sys.excepthook() SystemExit, , ValueError .