473,573 Members | 2,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python in Notepad++

1 New Member
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.
Aug 26 '07 #1
6 59899
6,596 Recognized Expert Expert
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.
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
1 New Member
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 <UserDefinedCom mands> 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.sourc eforge.net/Run
Feb 2 '08 #3
1 New Member
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%\A pplication Data\Notepad++\ shortcuts.xml in palin notepad (keep NP++ closed while editing) and play around with the command.
Oct 4 '09 #4
2 New Member
Or you could setup NppExec
Go to Plugins -> NppExec -> Execute (default F6, you can change this)
Type in the window:
C:\Python31\pyt hon.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
Sean Asemani
4 New Member

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">pytho n &quot;$(C:\Pyth on26\EXERCISES\ logistic.py)&qu ot;</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.

Feb 13 '11 #6
Sean Asemani
4 New Member
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\pyt hon.exe "$(C:\Python26\ EXERCISES\Mepri nt.py)"
But when I run it I get the following error:

C:\Python26\pyt hon.exe ""
Process started >>>
C:\Python26\pyt hon.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

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 a tcp-server, using something like os.system("notepad") or os.system("start /w notepad")
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 loop like Tcl's "after forever"?
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 in Notepad trying to open "c: est.txt".
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')
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 my general education. Mark
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 the instructions and couldnt get the correct results. heres the code stuff... temperature=input("what is the temperature of the spam?") if...
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 programs that have worked flawlessly on all previous Python versions for years and they are now producing incorrect results in the code that uses...
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 by ID * Find out which process ID is locking an object in the filesystem * Find out all the IDs of a particular .exe file * Find all the details...
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 entered following line: C:\Python26\python.exe "$(C:\Python26\EXERCISES\logistic.py)"
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.