Reputation: 417
Is there a keyboard shortcut to run all code above the selected line in Spyder IDE?
A workaround would be to select all code above that line and execute. But I am looking for a simpler solution.
Upvotes: 1
Views: 2197
Reputation: 89
I'd like to see an answer to this question also.
However, I know of workarounds. (1) You can mark the line with a red dot (or F12) and then run in debug mode (ctrl F5). This will automatically stop at the marked stop.
(2) You put something wrong on purpose at that spot and run with F5. Code will break at the 'mistake' you put. Alternatively you can also put sys.exit() (import sys), but that requires a bit more work.
Upvotes: 0
Reputation: 34156
(Spyder maintainer here) You can use cells for this. A cell is created when you write a comment of the form # %%
and it breaks your file in two: all the code before that comment and the one afterwards.
Each of these cells can be evaluated with the shortcuts Shift+Enter (run cell and advance to the next one) and Ctrl+Enter (run cell and remain on it).
Upvotes: 1