NppExec - How to Kill Process Automatically

0

1

I am coding python on Notepad++ and frequently use matplotlib. If I have a plot open and would like to rerun the code, an annoying dialog box comes up saying that: "NppExec - WARNING - Console process is still running".

This issue has been brought up before but it seems the developer was a bit stubborn? I just wanted to know that if in 2019 that this issue is resolved or if anyone has come up with a workable workaround.

If not, does anyone recommend any other text editor that is suitable with python + machine learning.

Al-Baraa El-Hag

Posted 2019-11-30T19:38:14.443

Reputation: 1

Answers

0

As of this writing (December 2019) the warning dialog you are inquiring about still exists. The simplest way to "bypass" this warning is to close the plot before you rerun your code (regardless of the steps presented below).

An "Automatic" Solution


Note: These steps assume you are running Notepad++ on Windows.


As an alternative to simply closing the plot manually each time, in NppExec you should be able to run e.g.:

TASKKILL /F /IM python.exe
CMD /C START "" /MIN python "$(FULL_CURRENT_PATH)"

You should have a look at TASKKILL, CMD and START respectively for detailed explanations of the options for each command, but in essence these commands kill any existing python.exe processes then spawn another set of processes that are decoupled from NppExec/Notepad++ (so they don't need to be terminated before running a new set of processes again).

As a small caveat, this won't prevent the warning with any pre-existing windows. You will still need to close them manually first.


"$(FULL_CURRENT_PATH)" is a built-in Notepad++ variable and requires that the current document have an existing path (i.e. it's been saved) to work correctly. Otherwise, you can just use the full path to your code (e.g. C:\path\to\code.py).


Anaksunaman

Posted 2019-11-30T19:38:14.443

Reputation: 9 278