By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,282 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,282 IT Pros & Developers. It's quick & easy.

Python in Notepad++

P: 1
Hi Everybody,
I am new to Python and also new to Notepad++. Can any one help to code my first python program in Notepad++. I am already doing it in python interpretor, but now i was to do in Notepad++. I have already downloaded Notepad++, but still not able to run any python program in it.
I request any of you to help me start in NOtepad++ with python.
Thanks
Aug 26 '07 #1
Share this Question
Share on Google+
6 Replies


bartonc
Expert 5K+
P: 6,596
Hi Everybody,
I am new to Python and also new to Notepad++. Can any one help to code my first python program in Notepad++. I am already doing it in python interpretor, but now i was to do in Notepad++. I have already downloaded Notepad++, but still not able to run any python program in it.
I request any of you to help me start in NOtepad++ with python.
Thanks
The answer to that question is in reply #7 of this thread, but I think that you will find the IDLE is sufficient for your needs for the time being and has much of the things that you will have to work on to get Notepad++ working built in. The aforementioned thread also discusses other IDE options.
Aug 26 '07 #2

P: 1
There is a simple way to do it.
In the Run menu, you can see options like "Lunch in firefox" and more.
These options are written in a file called shortcuts.xml, located in the folder where you installed NP++.
Open this file, and inside <UserDefinedCommands> you'll find this row:
Expand|Select|Wrap|Line Numbers
  1.  <Command name="launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command>
All you need to do is copy this line and change some things. Then you'll have something like this:
Expand|Select|Wrap|Line Numbers
  1. <Command name="Run with Python" Ctrl="no" Alt="no" Shift="yes" Key="112">python &quot;$(FULL_CURRENT_PATH)&quot;</Command>
(I chose Shift+F1, but you can choose any keys you like.)

Reopen NP++, and now it's easy and nice to run any python file strait from the editor.
More information on things like this in NP++: http://notepad-plus.wiki.sourceforge.net/Run
Feb 2 '08 #3

P: 1
thanks weightlessness for the direction, you can also try this
Expand|Select|Wrap|Line Numbers
  1. <Command name="python+arg" Ctrl="yes" Alt="no" Shift="no" Key="122">cmd /K &quot;$(FULL_CURRENT_PATH)&quot; $(CURRENT_WORD)</Command>
here i call a command line (with th /k switch so it doesn't close after execution or errors), i also add the CURRENT_WORD for if i want to add arguments (i keep some for debugging as comments in the code).

note i have python.exe in my PATH so i can call the .py file as is.

there is no easy way to edit the command once you enter it, i open %USERPROFILE%\Application Data\Notepad++\shortcuts.xml in palin notepad (keep NP++ closed while editing) and play around with the command.
Oct 4 '09 #4

P: 2
Or you could setup NppExec
Go to Plugins -> NppExec -> Execute (default F6, you can change this)
Type in the window:
C:\Python31\python.exe "$(FULL_CURRENT_PATH)"

Make sure the path to python.exe actually points to where your python.exe is :)

Click Save and save it whichever name you want it to be saved as.
And you're done. Switch between any files you like press F6 then Enter and you've compiled it!

Happy coding!
Nov 18 '09 #5

P: 4
Hi

I'm new to python and notepad++.
I use python 26 with its shell but I like to use notepad++.
I also have installed python 27, 31 all in its own directory.(on XP)

I've read your comment on changing the 'shortcuts.xml' in notepad++ director to enable notepad to run python.
I did make a change to 'shortcuts.xml' as:

<Command name="Run with Python26" Ctrl="no" Alt="no" Shift="yes" Key="112">python &quot;$(C:\Python26\EXERCISES\logistic.py)&quot ;</Command>

but it doesn't work at all.
Could you please tell me what could be wrong?
If you put correct line for that file, I could just copy and past it into 'shortcuts.xml' file.

thanks
Feb 13 '11 #6

P: 4
Hi Crisb

I've read your comment on how to change the
Plugins -> NppExec -> Execute in notepad++ in order to run python script and compile it.

I put the following in NppExec > Execute window as:

C:\Python26\python.exe "$(C:\Python26\EXERCISES\Meprint.py)"
But when I run it I get the following error:

C:\Python26\python.exe ""
Process started >>>
C:\Python26\python.exe: can't find '__main__.py' in ''
<<< Process finished.

Do you have any idea what could be wrong.

I've tried it with python 2.7 and 3.1 (which are installed in different folders) but still same error.

thanks for input.
Feb 13 '11 #7

Post your reply

Sign in to post your reply or Sign up for a free account.