About 3,900,000 results
Open links in new tab
  1. python - How do I terminate a script? - Stack Overflow

    Sep 16, 2008 · import sys sys.exit() details from the sys module documentation: sys. exit ([arg]) Exit from Python. This is implemented by raising the SystemExit exception, so cleanup actions …

  2. Python exit commands - why so many and when should each be …

    Nov 3, 2013 · exit() is an alias for quit (or vice-versa). They exist together simply to make Python more user-friendly. Furthermore, it too gives a message when printed: >>> print (exit) Use …

  3. Difference between exit () and sys.exit () in Python

    Oct 7, 2016 · In Python, there are two similarly-named functions, exit() and sys.exit(). What's the difference and when should I use one over the other?

  4. How to stop/terminate a python script from running?

    Nov 5, 2013 · If your Python program doesn't catch it, the KeyboardInterrupt will cause Python to exit. However, an except KeyboardInterrupt: block, or something like a bare except:, will …

  5. Difference between exit(0) and exit(1) in Python - Stack Overflow

    Feb 24, 2012 · What's the difference between exit(0) and exit(1) in Python? I tried looking around but didn't find a specific question on these lines. If it's already been answered, a link would be …

  6. How to exit Python script in Command Prompt? - Stack Overflow

    Jan 8, 2017 · On previous computers, when I would try to exit a Python script on the Windows command prompt, all you need to do is press ctrl+c. But when I do that on my computer it tells …

  7. python - Process finished with exit code -1073741819 …

    May 31, 2018 · all_objects=muppy.get_objects() # this causes pydev debugger exit with code -1073741819 (0xC0000005) It was perfectly fine if execute the same piece of code through …

  8. How do I abort the execution of a Python script? [duplicate]

    Jan 26, 2010 · The default is to exit with zero. import sys sys.exit("aa! errors!") Prints "aa! errors!" and exits with a status code of 1. There is also an _exit () function in the os module. The …

  9. python - Doing something before program exit - Stack Overflow

    Oct 3, 2010 · How can you have a function or something that will be executed before your program quits? I have a script that will be constantly running in the background, and I need it …

  10. Explaining Python's '__enter__' and '__exit__' - Stack Overflow

    Python calls enter when execution enters the context of the with statement and it’s time to acquire the resource. When execution leaves the context again, Python calls exit to free up the resource.