Rick
Rick

Reputation: 45291

Correct way to launch and close interactive ipython session from notepad++

What I would like to do is launch an interactive ipython session from notepad++, and keep the window open (in interactive mode) after a script completes, but for the window to close once I exit from ipython. This seems like a fairly simple task, but I'm having trouble finding the answer.

In notepad++, I have entered the following for the Run command (F5):

cmd /k ipython -i "$(FULL_CURRENT_PATH)"

This works fine: it opens and runs the script I am editing using ipython, and keeps the ipython session open once the script is complete.

However, after entering the exit command, I have to enter exit a second time at the command prompt) to close the window (or close it with the mouse). It would be nice if I didn't have to enter exit twice. Is there a solution to get things working the way I want them to work?

I have tried removing /k flag (my understanding is this flag keeps the window open):

cmd ipython -i "$(FULL_CURRENT_PATH)"

However, the script does not seem to run at all in this case.

Upvotes: 3

Views: 588

Answers (1)

Rick
Rick

Reputation: 45291

Well I discovered the answer just before I was about to post the question! Instead of deleting it altogether, I thought I would go ahead and post the resolution so that others can find it later. It turned out to be pretty simple!:

ipython -i "$(FULL_CURRENT_PATH)"

(Note that in order for this to work, ipython must be available as a program to be run from a command prompt.)

Upvotes: 1

Related Questions