Configure Notepad++ to run a python

notepad_logo

Install python (3.4)

  1. Download the python 3.4(preferable 32 bit) windows installer from http://www.python.org/download/
  2. Run through the installer using the default settings for everything.  It should install python in the folder: C:\Python34.  If you’re using a different version of python, just substitute out the version number wherever you see 34.

Install Notepad++

  1. From http://notepad-plus-plus.org/download, download the Notepad++ installer.
  2. Run through the installer using the default settings for everything.
  3. Open Notepad++

Configure Notepad++ to run a python script

  1. Open up a command prompt
  2. Run the following command:
set PATH=%PATH%;C:\Python34

Note: If your version of python was installed in a different location, make sure to substitute out that location with the one in the command.

You can use the following command to make sure the python path was added to the PATH variable:
echo %PATH%

You should see the location of the python directory at the end of the output.

  1. Switch back to Notepad++, and go up to the menu bar, select Run, and then select Run… (F5)
  2. Insert the following in the text box that appears:
    C:\Python34\python.exe -i "$(FULL_CURRENT_PATH)"
  3. Click Save…
  4. Configure CTRL+R to be the command.  Give it a name, and press OK.
Now whenever you want to run the python script you’re working on, press CTRL+R and it will be executed.  Also you should see the window stay opened after command execution for debugging purposes because of the -i flag. Remove it if you don’t want that feature.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s