Spyder IDE reload code with run selection ('F9')

丶灬走出姿态 提交于 2019-12-24 12:22:06

问题


Is it possible to make UMR work with 'F9' (run selection)? I often use the run selection feature in spyder to call a specific function of a module under debugging from an external script (MATLAB workflow). Using an external script helps to provide the required function input (variable explorer,...).

However, I don't want to run the entire script from the beginning ('F5'), since it contains time consuming calls. Unfortunately, it seems like modified modules are only updated via UMR when running the entire script file. In contrast, when using run selection, a reload() is required each time the module is slightly changed.

A workaround is to find and comment out all time consuming calls and then run the entire script to check the module, what is quite annoying since this must be revoked afterwards.

Is there a better way?


回答1:


(Spyder developer here) To reload code of a module you're developing in the Editor, as soon as you save it and without using F5, you need to run these two commands before start working on an IPython console:

In [1]: %load_ext autoreload
In [2]: %autoreload 2


来源:https://stackoverflow.com/questions/44824562/spyder-ide-reload-code-with-run-selection-f9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!