Instructions for stopping a running program


 

As you will see, it is easy to write a program that runs forever or "gets stuck in an endless loop".

Some kinds of "endless" programs will crash on their own because they use up hidden resources on your laptop, which means the operating system (Mac, Windows) will intervene.

But it's equally possible to write a harmless program that merely either just "waits for the user" or is in an endless loop.

In either case, it's very useful to be able to stop a program from continuing to execute.
 

Thonny users: Thonny already has an easy way to do this from the Run menu: simply click on Interrupt Execution or type control-c (the control key and the c key simultaneously).
 

Spyder users: Stopping a running program is a bit more complicated in Spyder because Spyder behaves differently depending on which part of Spyder "has the focus".



Back to Module 2