`runfile` resets namespace
See original GitHub issueI runfile
a lot, and just noticed that it doesn’t involve re-running the startup script. Is this intended? It’s rather self-defeating if I must restart the kernel each time for startup functions to be available (or for arbitrary scripts to execute).
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (23 by maintainers)
Top Results From Across the Web
TypeError: runfile() got an unexpected keyword argument ...
This will be fixed in Spyder 5.1.2. In the meantime, downgrade the ipykernel package in the environment to 6.2.0:
Read more >IPython Console — Spyder 5 documentation
The IPython Console allows you to execute commands and interact with data inside IPython interpreters. Spyder IPython Console with code, inline plots, and...
Read more >I am using spyder and am getting an error when trying to ...
Hi, i am currently working on spyder and am getting an error message (see below) when trying to import the module.
Read more >Untitled
runfile ('/Users/progprim/Desktop/lecture05-exceptions.py', ... exec(compile(f.read(), filename, 'exec'), namespace) ... In [84]: %reset.
Read more >Spyder - the Python IDE — Computational Science and Data ...
2.1 Switch to an IPython console; 2.2 Reset the name space; 2.3 Strive for PEP8 ... In [1]: runfile('/Users/fangohr/Desktop/hello.py', ...
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
As I said, running the startup script after every runfile by default could be a bit confusing. For example if you set a variable
myvar
in the startup script and in the file you run, you would not be able to preserve the script’smyvar
. As a workaround I would advise that the startup script adds whatever you want to keep to thebuiltins
module. That way it will survive thereset
, which is really what you want:Fair enough. And interesting bot you have there.