Spyder: re-run last cell : no working (despite the shortcut key being defined in spyder 4)

Created on 17 Apr 2020  路  12Comments  路  Source: spyder-ide/spyder

Awaiting Followup

Most helpful comment

Thanks for the tip Steff, I am now following: https://twitter.com/Spyder_IDE

All 12 comments

Working for me. Please be sure to use our latest version (4.1.2).

It works for me in spyder 3.6, however, not in any of the spyder 4's (including 4.1.2)

Even if I navigate via the interface: "run" > "re-run last cell" ; it does nothing, while in spyder 3.6 it runs my last run.
It's very weird if this is peculiar to me (because it works in spyder 3's) ; but if nobody has got this issue, then I wonder.

I will just run 3.6 until I figure it out; anyhow, congrats on the new spyder, it does look amazing, as does spyder 3; you guys are providing a huge service to the community.

I'm having this issue as well. Spyder 4.1.3. Python 3.8.1 64-bit | Qt 5.9.7 | PyQt5 5.9.2 | Darwin 19.4.0. MacOS Catalina.

Run last cell does nothing. Run last script works.

Perhaps it's an issue only on macOS. @steff456, could you verify if that's the case? The shortcutt to re-run the last cell is Alt+Enter.

On my Macbook Alt+Enter (that is, Shift+Option+Enter, because the Alt key is positioned as a shifted Option) is associated with debug cell (I don't believe I have altered this keyboard shortcut in the past, so I assume it's the default). The rhs Shift+Option+Enter yields the same.

I cannot reproduce this issue, when I use the shortcut Atl+Enter it works as expected.
@ptoche have you tried changing the shortcut to another one? The Shift+Option+Enter is the default shortcut for debug cell

@steff456 I have F12 currently bound to "run selection", which works. I have tried to bind F11 and F10 to "re-run last cell", but nothing happens. Just to be clear I understand the meaning of "re-run last cell": it will run whatever was run immediately before? Say I run print("Hello World!") followed by "re-run last cell", it will print Hello World! twice? Or am I misunderstanding? Thanks.

I tried to reproduce this bug with the following code

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

#%%
a = 8
print(a)


#%%

b = 15
print(b)

I have three cells, so if I run the middle one with run cell it will print me an 8. Then, if I change the cursor to anywhere outside that cell and use re-run last cell it will print me an 8.

Please let me know if that works for you :)!

@steff456 , That worked perfectly! I'm embarrassed to say that I realize now that I didn't know what a cell was. I thought that re-run last cell meant that if I had executed print(8) and then invoked re-run last cell from anywhere in Spyder, it would have printed an 8. I realize now this works only if you create cells in the document, where a cell is defined as all the lines below #%%.

False negative from me. Apologies.

Ok @ptoche, don't worry about it :)
Right now we are working in documentation and videos for Spyder so you can learn all the features that we have! Please follow us in social networks to see all the content once it is out :D

Thanks for the tip Steff, I am now following: https://twitter.com/Spyder_IDE

@steff456 , That worked perfectly! I'm embarrassed to say that I realize now that I didn't know what a cell was. I thought that re-run last cell meant that if I had executed print(8) and then invoked re-run last cell from anywhere in Spyder, it would have printed an 8. I realize now this works only if you create cells in the document, where a cell is defined as all the lines below #%%.

False negative from me. Apologies.

This does work; however, in spyder 3, if one uses the same function (or keyboard shortcut), one does run the last run selection again, in contrast of what happens in spyder 4, which only runs the pre-defined cell.

Was this page helpful?
0 / 5 - 0 ratings