views:

1062

answers:

2

I prefer using notepad ++ for developing,

How do I execute the files in Python through Notepad++?

+1  A: 

Here is a plugin to do this: http://magicpc.wordpress.com/2009/11/03/notepad-plugin-to-run-python-scripts/

(Scroll to the bottom of the page to download it)


Edit:

I would go for option three.

  • First option: (Not safe)

    The code opens “HKEY_CURRENT_USER\Software\Python\PythonCore”, if the key exists it will get the path from the first child key of this key.

    Check if this key exists, and if does not, you could try creating it.

  • Second option:

    Use a batch script that runs the Python script and then create a shortcut to that from Notepad++.

    As explained here: http://it-ride.blogspot.com/2009/08/notepad-and-python.html

  • Third option: (The easiest one)

    Open Notepad++. On the menu go to: Run -> Run.. (F5). Type in:

    C:\Python26\python.exe "$(FULL_CURRENT_PATH)"
    

    Note: If you have Python 3.1: type in Python31 instead of Python26

    Now, instead of pressing run, press save to create a shortcut for it.

Reshure
thanks, however i get "could not locate python"
richtea
do you have python installed?
Autoplectic
Added some more information.
Reshure
hmm, thanks for the help so far.I tried option 2, that didnt work. It said :http://i37.tinypic.com/b4fhfm.jpgOn Windows 7, this might be the problem?
richtea
The problem is that you have spaces in the path to the file that it's trying to open, and your script doesn't put double quotes around it.
Robert Rossney
any other ways to get run python file from notepad ++?
richtea
Added another option. This is probably the easiest one.
Reshure
that worked, however the console just disappears straight away
richtea
You have to ask for input or use: import time; time.sleep(..) then. And, by the way, don't forget to set this as accepted if your question is answered. :)
Reshure
I'm importing 2 things, getpass and twitter api. and i have several inputs.
richtea
I've tried this with: import time; print("Hello World"); time.sleep(5); and it did not disappear. Maybe there is an error with the imports? Have you tried running it from Python?
Reshure
yes, it runs fine from python.
richtea
bingo fixed it, thanks.
richtea
Open Notepad++. On the menu go to: Run -> Run.. (F5). Type in: cmd /K "$(FULL_CURRENT_PATH)"
Ramiz Uddin
A: 

Finish coding in notepad.

open the command prompt

cd <wherever you have installed python>

python <filepath to that notepad file with your code in it>

DONE!

inspectorG4dget