spyder: The stop execution button (red square) doesn't always stop execution (looped try statements)

Description of your problem

What steps will reproduce the problem?

  1. run this code:
import time
for i in range(0,100):
    try:
        time.sleep(5)
        print('hey %d'%i)
    except:
        pass
  1. try stopping it with the red square stop execution button

What is the expected output? What do you see instead? The program stops. What actually happens is that it tries to stop once, the except part of the try statement is triggered and the script continues. But now the stop execution button is greyed out and unusable

Suggested Changes The stop execution script should loop and continuously try until some confirmation is given that the script has stopped. The red square button shouldn’t become greyed out and unusable until the script has actually stopped

Versions and main components

  • Spyder Version: 3.1.4
  • Python Version: 2.7.13 64 bit
  • Qt Version: Qt 5.6.2
  • PyQt Version: PyQt5 5.6
  • Operating system: Ubuntu 16.04 LTS

Dependencies

Please go to the menu entry Help > Optional Dependencies (or Help > Dependencies), press the button Copy to clipboard and paste the contents below: jedi >=0.9.0 : 0.9.0 (OK) matplotlib >=1.0 : 2.0.2 (OK) nbconvert >=4.0 : 5.1.1 (OK) numpy >=1.7 : 1.12.1 (OK) pandas >=0.13.1 : 0.20.2 (OK) pep8 >=0.6 : 1.7.0 (OK) psutil >=0.3 : 5.2.1 (OK) pyflakes >=0.5.0 : 1.5.0 (OK) pygments >=2.0 : 2.2.0 (OK) pylint >=0.25 : 1.6.5 (OK) qtconsole >=4.2.0: 4.3.0 (OK) rope >=0.9.4 : 0.10.5 (OK) sphinx >=0.6.6 : 1.6.1 (OK) sympy >=0.7.3 : 1.0 (OK)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 30 (10 by maintainers)

Most upvoted comments

also had this problem w/out catching any exceptions (spyder 4.2.1).

wanted to mention that you can do a hard stop beyond ‘red button’ like this:

  1. find ipython console window
  2. find a console tab in this window
  3. right click on console tab
  4. click ‘restart kernel’

Shortcut to this is Ctrl+.

hope that helps.

Hi @opendatasurgeon , I think you are running into another issue then. Could you try to update spyder, and if the problem persists, oppening a new issue with a reproducible code?

I can confirm, I am facing similar issues unfortunately. Thank you in advance!!

Yes, I am on Spyder 4 still facing same issue.

Spyder 3.3.6 / ipython 7.8.0

I still have the same issue too