
0
Under review
Restart python kernel
Hi,
I'm in the process of creating a series of modules that contain some handy functions to use in Micromine. In order to load the modules at the beginning of the script in Micromine I enter the following
import sys
my_folder = "D:\\Projects\\Python_Scripts"
sys.path.append(my_folder)
import mm_tools as tools
It appears that the module is only imported the first time I run the script. If I make any changes to the module mm_tools then I have to shut down Micromine and then restart it. This makes debugging (which I have to do a lot) a bit annoying.
I guess (from my limited Python experience!) that I have to restart the python kernel. Is there a way to do this in Micromine without shutting down the whole program? The Ipython Notebook has a restart option. Would it be possible to add a button to the script editor that does this?
This would also be useful if running lots of memory hungry scripts in a row as it appears that I have to restart Micromine to clear the memory.
Thanks Rupert
I'm in the process of creating a series of modules that contain some handy functions to use in Micromine. In order to load the modules at the beginning of the script in Micromine I enter the following
import sys
my_folder = "D:\\Projects\\Python_Scripts"
sys.path.append(my_folder)
import mm_tools as tools
It appears that the module is only imported the first time I run the script. If I make any changes to the module mm_tools then I have to shut down Micromine and then restart it. This makes debugging (which I have to do a lot) a bit annoying.
I guess (from my limited Python experience!) that I have to restart the python kernel. Is there a way to do this in Micromine without shutting down the whole program? The Ipython Notebook has a restart option. Would it be possible to add a button to the script editor that does this?
This would also be useful if running lots of memory hungry scripts in a row as it appears that I have to restart Micromine to clear the memory.
Thanks Rupert
Customer support service by UserEcho
Yes, it is a know problem of Python. The workaround is to use imp module the following way:
my_folder = "D:\\Projects\\Python_Scripts"
if not my_folder in os.sys.path: os.sys.path.append(my_folder)
import mm_tools
imp.reload(mm_tools)
import mm_tools as tools
This should work
That will save me hundreds of restarts!