question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add command 'clear' to spyder - Feature request

See original GitHub issue

Description of your problem

So far, the only script command to clear the workspace variables is the horrible command:

from IPython import get_ipython
get_ipython().magic('reset -sf')

I am aware of this, but it really does not address this problem as the “option to “clear all” variables before running file” is still GUI defined and once enabled, it will always clear all the variables for every re-run until the user disables it again. Typically only the scripts that start with ‘clear all’ are intended to clear the workspace, the other scripts that don’t start with ‘clear all’ are not. Whether the workspace is cleared or not should be defined in the script and not in the GUI preferences.

‘clear all’ and ‘clear’ are extremely useful Matlab, GNU Octave, FreeMat and Scilab functions that are not yet implemented in Spyder.

A possible solution would be to create a spyder or Ipython function called clear all the would basically call the horrible aforementioned command. What do you guys think?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Jul 2, 2017

Sorry, but if we add a command like that then things won’t work outside of Spyder.

0reactions
crazyBabooncommented, Jul 8, 2017

I have tested the command from IPython import get_ipython get_ipython().magic('reset -sf') and it does not work, i.e. it does not clear the workspace. In addition it makes the variable explorer stop displaying variables. Is this my machine being weird? I am using spyder 3.1.4 and python 3.6.1, Antergos Linux 64 bit

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clear history pane in Spyder - python - Stack Overflow
(Spyder maintainer here) You said. It seems the history tab cannot be cleared using the interface. Spyder documentation is silent on that.
Read more >
IPython Console — Spyder 5 documentation
To launch a new IPython instance, go to New console (default settings) under the Consoles menu, or use the keyboard shortcut Ctrl -...
Read more >
Spyder Keyboard Shortcuts - KeyCombiner
Spyder logo Spyder Key Combinations ; Spyder documentation, f1 ; Restart, alt + shift + r ; Quit, ctrl + q ; Editor....
Read more >
Walkthrough — tellurium 2.2.3 documentation
You can add new cells by moving your cursor past the last cell in the ... to run a Windows command prompt with...
Read more >
Feature Request: Break and Debug where Error Occured
First - for the record I think Spyder is fantastic, an easy to use and powerful IDE for Python. I use it all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found