Python Forum
How to stop an infinite loop in spyder if it's currently running?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to stop an infinite loop in spyder if it's currently running?
#1
I'm stunned I haven't been able to find anything online about stopping a program you've run.
The only thing I've been able to do so far is close spyder using a task manager and reopen it which is incredibly inefficient.
One site did say try ctrl+c which didn't work.
Reply
#2
Post the code so we can help
Reply
#3
my code:
print('Please think of a number between 0 and 100!')
guess=50
lowguess=0
highguess=100


while True:
    print('is your secret number ' + str(guess) + '?')
    x=input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ")
    if x=='c':
        print('Game over. Your secret number was: ' +str(guess))
    if x=='h':
        guess+=-1
    if x=='l':
        guess+=1
    else:
        print("Sorry, I did not understand your input.")
I figured out how to fix the code by adding a break after line 11.

My primary question is how do I stop this code from running if I don't have a break on line 11? so far I've had to end it with a task manager and relaunch spyder.
Reply
#4
Check here: https://github.com/spyder-ide/spyder/issues/1101

It looks like the focus has to be on the right window.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Infinite loop Danado 4 2,324 Aug-16-2021, 05:56 PM
Last Post: deanhystad
  Question about running comparisons through loop from input value Sunioj 2 2,362 Oct-15-2019, 03:15 PM
Last Post: jefsummers
  How to stop a loop? beginner1996 2 2,994 Mar-08-2019, 08:17 AM
Last Post: perfringo
  Help with while loop creating an infinite loop. FWendeburg 3 2,994 Jan-30-2019, 08:28 PM
Last Post: FWendeburg
  Infinite loop/ only half working anclark686 5 4,675 Sep-09-2018, 07:31 AM
Last Post: buran
  Why is this giving me an infinite loop? wlsa 4 3,835 Jul-25-2018, 10:11 PM
Last Post: cyberpatje
  Another infinite loop wlsa 7 4,593 Jul-20-2018, 12:04 AM
Last Post: wlsa
  Infinite loop Truman 9 9,004 Jan-19-2018, 11:25 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020