Open shivendra90 opened 4 years ago
Hi @shivendra90,
So, you will like to have a checkpoint of the state of the console in case you accidentally press run file?
Sorry I did not get that @steff456 . You mean you would like to see some log for the console when this occurred? I actually did not press 'run file' since the script is long and I personally prefer making cells and running them instead of running each line.
I think I'm not getting what error you are experiencing. Do you have any reproducible case we can use to try to get the same behavior you are having?
There is no error message per se. It's just when yesterday I was trying to run some cells from the python script in Spyder, instead the whole file was being executed when pressing Ctrl+Enter or hitting the 'run cell' button on the toolbar. That was not what I was expecting. I certainly thought this could be a bug. I'm not sure if anyone else has experienced this. For example if I have a cell like this:
#%% Load libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sb
from statsmodels.formula.api import ols
from statsmodels.stats.anova import anova_lm
from pandas import read_csv, DataFrame
When running this cell essentially there should be no output. However, when I ran this the whole python script was being executed as if I had hit F5 and that of course took a lot of memory. I thought I might have hit the wrong keys but that was all correct; I had to restart Syder to get individual cells working again. i hope you get my point. I think I'm the only one who has seen this.
Did you have more cells after the one you are showing me?
Yes. The python script has 11 complete cells. Upon running any of the cells, for some reason the whole file was being run. This is the history of the console that I'm pasting here:
runcell("Load libraries")
runcell('Load libraries', '/home/shivendra/Desktop/Great Learning/pgp dsba/Advanced Stats/Final project/adv_stats.py')
runcell('Load libraries', '/home/shivendra/Desktop/Great Learning/pgp dsba/Advanced Stats/Final project/adv_stats.ipy')
runcell('Load libraries', '/home/shivendra/Desktop/Great Learning/pgp dsba/Advanced Stats/Final project/adv_stats.py')
runcell("Load libraries")
I don't think so this will be very helpful but you can notice that I tried running the same cell over and over again. This is because the cell 'Load libraries' was instead running the whole file and I thought I might be hitting the wrong keys. I also tried running it manually by typing in the command runcell()
but it still ran the whole file. I tried this for several minutes and eventually did a restart of Spyder. However my time was up so I decided to check on this again yesterday where I paste the history:
runcell("Load libraries")
runcell("Load data and display view")
runcell('Describe data and info', '/home/shivendra/Desktop/Great Learning/pgp dsba/Advanced Stats/Final project/adv_stats.py')
Now you can notice that I'm running each cell one by one and the output came as expected. Overall it was not a breaking problem, a simple restart fixed it but certainly something was not right and thought I might report here.
Ok! Please if you see that you can reproduce this error in the future, and can give us the code you are working in please add it here in this issue so we can try to reproduce it. I will leave this issue open if someone else encounters the same error and we can track it down 😊
This bug is still present in Spyder 5.3.3 and like the OP I can resolve it with a restart of Spyder.
For me it shows up when renaming a file and the target name has the suffix .ipy
. As in:
name.py
-> name.ipy
name.ipy
-> newname.ipy
orname.py
-> newname.ipy
temp.ipy
with the following content:# %% a
print("a")
# %% b
print("b")
newname.ipy
.Hey @joooeey, thanks for the detailed description on how to reproduce this problem. We'll take a look at it for Spyder 6, to be released later this year.
Just wondering if there is any progress on this. Using Spyder 6.0.1, Python 3.11.4 64-bit, Qt 5.15.2, PyQt5 5.15.11, still exhibits the issue. On top of this pressing F9 which is supposed to 'Run selection or current line' gives the same result. Thanks!
Using Spyder 6.0.1, Python 3.11.4 64-bit, Qt 5.15.2, PyQt5 5.15.11, still exhibits the issue.
What's exactly the issue @PeterHristov?
On top of this pressing F9 which is supposed to 'Run selection or current line' gives the same result.
What's the result? Could you post a video showing that?
@ccordoba12, the issue is the one mentioned by the OP - Ctrl+Enter runs the whole file and so does F9. It persisted for a while, but I haven't encoutered it since my post. I use Spyder on an almost daily basis, so I will be on the look out and if I can capture the behaviour I will post about it here.
the issue is the one mentioned by the OP - Ctrl+Enter runs the whole file and so does F9.
Ctrl+Enter does run the entire file if no cell is present. However, F9 shouldn't do that.
I use Spyder on an almost daily basis, so I will be on the look out and if I can capture the behaviour I will post about it here.
Ok, thanks for your help with that.
Is there any progress on this problem? because i am experiencing it a lot in a large project and it really anoys me.
Did you change the standard Hotkeys for spyder 6.0 onwards? Because i found that STRG+Enter is now "execute cell" per default, whereas Shift+Enter is now "Execute cell and advance". I am a longtime user, and this behavior seems odd to me, especially since i never changed or change the hotkeys
found here
Description
I started Spyder to do work further on one of my academic assignments. For some reason which I think could be a bug, pressing Ctrl+Enter (run a cell) ran the whole file instead. This is the first time I'm observing this. I've been creating cells in the python script I'm writing for the last couple of days and cells ran fine. Doing a restart of Spyder solves this problem.
What steps will reproduce the problem?
Steps to reproduce:
In most cases the cells will run fine but it could be that you accidentally run the whole file instead when running any of the cell. I do not have a snapshot for this or I could have shown it here, so apologies if I'm not able to show any evidence. I did a restart and now the cells run fine.
Versions
Dependencies