Shift-Enter to run a cell is not cached
See original GitHub issueDescription
What steps will reproduce the problem?
If you have two consecutive code cells (starting with a #%%) and you try to run them both by pressing Shift-Enter twice, only the first cell will be run.
This happens when the first cell takes some time to run, and it’s still running when you press the second shift-enter. The second shift-enter is ignored.
In version 3.X it works fine, running the two cells one after the other.
Versions
- Spyder version: 4.0.0b3
- Python version: 3.7.3
- Qt version: 5.12.3
- PyQt5 version: 5.12.2
- Operating System: Windows 10
Dependencies
pygments >=2.0 : 2.4.2 (OK)
qdarkstyle >=2.6.4: 2.7 (OK)
sphinx >=0.6.6 : 2.1.0 (OK)
pyls >=0.27.0 : 0.27.0 (OK)
nbconvert >=4.0 : 5.5.0 (OK)
pandas >=0.13.1 : 0.24.2 (OK)
numpy >=1.7 : 1.16.4 (OK)
sympy >=0.7.3 : None (NOK)
cython >=0.21 : 0.29.10 (OK)
qtconsole >=4.5.0 : 4.5.1 (OK)
IPython >=4.0 : 7.5.0 (OK)
matplotlib >=2.0.0: 3.1.0 (OK)
pylint >=0.25 : 2.3.1 (OK)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (10 by maintainers)
Top Results From Across the Web
How to cache in IPython Notebook? - Stack Overflow
When you execute this cell the first time, the code is executed, and the variables var1 and var2 are saved in mycache.pkl in...
Read more >Executing and caching your content - MyST-NB
MyST-NB can automatically run and cache notebooks contained in your project using jupyter-cache. Notebooks can either be run each time the documentation is ......
Read more >VS Code: Shift+Enter does not send code to Python Interactive
In my case, the Shift+Enter shortcut is "allocated" (for lack of a better word) to "Run Selection/Line in Python Terminal" AND also to...
Read more >Unshare a data cache between PivotTable reports
Click any cell in the PivotTable report for which you want to unshare the data cache. On the Options tab, in the Data...
Read more >Cache - Web APIs | MDN
Items in a Cache do not get updated unless explicitly requested; ... Make sure to version caches by name and use the caches...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think this is the correct way of doing this. I modified
runfile
in https://github.com/spyder-ide/spyder/pull/10115 to get the code from the editor, so we could even cacherunfile
. When this PR is merged, acache
parameter can be added to_handle_get_file_code
andhandle_run_cell
.Yeah that’s great idea. Definitely the way to go. The queue would then be a simple list of command strings and the cache would be a dictionary of code and hashes. We can have Spyder do all the code caching separately when it adds to the queue.
We could add an optional parameter to the runcell and runfile like
cache=None
which would be a little cleaner than adding it to the cellname and then having to parse it. Then we would be be able to cache whole files for runcell as well(the imported modules could still change but we have to stop somewhere).