Open schtandard opened 1 year ago
Hi @schtandard thank you for the feedback! I think I was able to reproduce this. Did you by any chance set a custom preference for your files using the Run > Configuration per file...
option? The thing is that the config that you can set from the preferences is the one that is referenced from the Run configuration per file
dialog as default so maybe you have the option Run file with custom configuration
set in that dialog?
This the config I have in order to reproduce this. Preferences config (default) vs Run configuration per file (the one that can override the default config):
Let us know if the info above helps!
Hi @dalthviz, thanks for looking into this. I have not set any preferences per file, no. Here's a screenshot of my settings.
Just in case, I also just tested it with per file configuration (identical to the default) and there is no change; the variables are still cleared before execution.
Rereading the OP, you mean by variables removed that they disappear from the Variable Explorer? I think the %clear
magic only removes the prompts and I think that is not configurable. So basically what you want is to preserve the prompt/console output between dedicated console executions right?
Hmm, it seems you are right. I thought I had verified that it also cleared the variables, but I can't reproduce that now.
I would still prefer for the %clear
not to happen at all. The effects of previous commands in the console are not erased, so erasing their inputs and outputs is confusing and unnecessarily makes them unavailable (both through scrolling and through ipython
's In[]
and Out[]
magic). It also does not match the behavior of Spyder's default setting to Execute in current console, where no %clear
is issued (no matter if variables are cleared or not).
Seeing as the issue as reported is non-existent, should I close it and open an appropriate feature request for removing the %clear
or making it configurable? Or should I just leave this one open instead?
I would still prefer for the %clear not to happen at all. The effects of previous commands in the console are not erased, so erasing their inputs and outputs is confusing and unnecessarily makes them unavailable ... It also does not match the behavior of Spyder's default setting to Execute in current console, where no %clear is issued (no matter if variables are cleared or not).
I think this is a fair point. We clear dedicated consoles after each execution because that's how they worked in the (very old) Spyder 2 days.
We'll take a look at this for Spyder 6, to be released later this year.
Issue Report Checklist
conda update spyder
(orpip
, if not using Anaconda)jupyter qtconsole
(if console-related)spyder --reset
Problem Description
When running every script in a dedicated console, the console is always cleared before running, irrespective of the relevant setting.
What steps reproduce the problem?
What is the expected output? What do you see instead?
I would expect subsequent runs of the same script to execute in the console without removing any variables, just like when using Execute in current console. Instead, a
%clear
is issued before every run, removing all variables before execution. The setting that seems to be intended to control this behavior appears not to have any effect.Versions
Dependencies