What’s the difference between sys.exit() and exit()?
Friday, August 19th, 2011I was trying to create a Windows binary using py2exe. When I run the exe file (it is a command line program) without any argument, it should print a usage message and exit. To my great surprise I saw this:
>> NameError: name ‘exit’ is not defined
Very weird. So I changed that line from exit() to sys.exit() and recomplied using py2exe, everything works perfectly now.
So what is the difference between sys.exit() and exit()?









