Monday, January 5, 2015

Notepad++ - how to run a python script quickly

I was making a mp3 player python script the other day and I had to use IDLE for the advantage of running the script.In IDLE you have a nifty keyboard shortcut F5 to run the script immediately. There is nothing wrong with it until I found out some commenting shortcuts that I don't like and some features that I miss from my favorite text editor Notepad++.

I was searching for a solution how to have a run feature just like the Python IDLE so that I can use Notepad++ for my purpose. I found some solutions but none of them worked for my purpose perfectly.

I tried NPP Exec plugin, and some other solutions but this one worked best for me.

Solution

1. Press F5.

Notepad++ Executing Python Script

2. Copy and Paste the following:

After that you can just press enter to run the script. But we want to save our command for later use. And we would also add a keyboard shortcut to that command.

3. Then click "Save..."

Notepad++ Executing Python Script

4. I have named my command "Run Python script"
5. I have assigned a Ctrl+F5 keyboard shortcut to run the current script. But you can choose whatever is convenient to you.

And don't forget to save the file before pressing Ctrl+F5.

So everytime you have to run a python script, just press Ctrl+F5. Good luck.

No comments:

Post a Comment