473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Python in Notepad++

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
6 59853
bartonc
6,596 Expert 4TB
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
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
yoshco
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
crisb
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
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
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

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

Similar topics

1
by: Roger | last post by:
I've got some MS-windows (XP only?) related questions; hopefully someone can give me some advise. 1) Is there some way to make notepad to become the front window when it is started from within...
4
by: Chang LI | last post by:
I tried to launch "python.exe test.py" in another program. After the launch the console was showed and exited on Windows. I want the console stay there. Is there a Python statement to wait an event...
17
by: George | last post by:
Newbie question: I'm trying to lauch Notepad from Python to open a textfile: import os b1="c:\test.txt" os.system('notepad.exe ' + b1) However, the t of test is escaped by the \, resulting...
15
by: ajikoe | last post by:
Hello, I use windows notepad editor to write text. For example I write (in d:\myfile.txt): Helo World If I open it with python: FName = open(d:\myfile.txt,'r')
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
24
by: Joe Salmeri | last post by:
I just upgraded from Python 2.4.2 to Python 2.5.1 and have found some unexpected behavior that appears to be a bug in the os.stat module. My OS is Windows XP SP2 + all updates. I have several...
1
by: Salim Fadhley | last post by:
Does anybody know of a python module which can do process management on Windows? The sort of thing that we might usually do with taskmgr.exe or process explorer? For example: * Kill a process...
2
by: Sean Asemani | last post by:
Hello All I am new to python and using python 2.6 for few weeks with no problem. I like notepad++ and trying to run pythons script in notepad++. In notepadd++, Run menu > Run dialog box I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.