About 237,000 results
Open links in new tab
  1. How to stop/terminate a python script from running?

    Nov 5, 2013 · While the previous answers are helpful, they don't always work in all situations. If you have a Python-CV window open, which is waiting for a key press to quit, while running …

  2. python - How do I terminate a script? - Stack Overflow

    Sep 16, 2008 · (Note: using exceptions for exits is a python practical work-around for C/C++/Java devs always inappropriately calling exit-- hence python programmers may not notice the …

  3. Programmatically stop execution of python script? [duplicate]

    The Python library reference explicitly states that those functions should only be used in the interactive interpreter and not in programs. – alldayremix Commented Feb 23, 2013 at 19:54

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

    Jan 26, 2010 · There is also an _exit() function in the os module. The sys.exit() function raises a SystemExit exception to exit the program, so try statements and cleanup code can execute. …

  5. How do I stop a program when an exception is raised in Python?

    Jan 13, 2009 · @kramer65: A program exit code of 0 means "finished without errors". Since the sys.exit call appears to be caused by an error, it should yield a program exit code that is not 0. …

  6. Exiting a program from an If/ELSE statement with Python

    Jan 9, 2023 · The program will continue calling keep_going() as long as it returns true, that is when a user answers "yes" An even shorter solution would be to call keep_going() after the …

  7. Stopping Python using Ctrl + C - Stack Overflow

    It turns out that as of Python 3.6, the Python interpreter handles Ctrl + C differently for Linux and Windows. For Linux, Ctrl + C would work mostly as expected. However, on Windows, Ctrl + C …

  8. How to properly quit a program in python - Stack Overflow

    Oct 23, 2012 · So Python is saying there's something wrong after the if statement. If you look at the other if statements, you'll notice that this one is missing the : at the end, so change it to: if …

  9. interrupt - Stopping a python program - Stack Overflow

    Apr 13, 2012 · The program stops neatly with a control c from a command line, but now it runs without a terminal window, so we need to be able to quit the program with the red quit button. …

  10. How to stop a program when a key is pressed in python?

    Mar 29, 2018 · I have a program that is an endless loop that prints "program running" every 5 seconds and I want to stop it when I press the end key. So I created a key listener that returns …