Please guide me how to run a python program with notepad++ as when i try to run it gives a shell execute error and when i try to check in run as administrator is already disabled on my computer.
@anand-Mishra, Welcome to the Notepad++ Community.
guide me how to run a python program with notepad++
I assume you mean you want to run a python program using an external python interpreter, like
python3.exe. I will use
python.exeto refer to whichever of those you want.
There are many ways to do this. In a pure Notepad++ environment, all you need to do is to use the Run menu’s Run item, enter
c:\path\to\python.exe "$(FULL_CURRENT_PATH)". Of course, the external window that pops up will disappear right away, unless your python script happens to end with a statement that waits for user-input. Alternatively, you could use
cmd /k c:\path\to\python.exe "$(FULL_CURRENT_PATH)", which will keep the cmd.exe window open, even after the python is done running. If you have
.pyfile associated with the correct
python.exealready, you can simplify to
cmd /k "$(FULL_CURRENT_PATH)"– though if you have spaces in the filename, it might need to be
cmd /s /k "$(FULL_CURRENT_PATH)"instead. If it’s a command you’ll use often, you can hit Save… instead of Run when done in the dialog, and you can save it as a macro, and even assign a keyboard shortcut.
I personally like having the results of running my python (or more often, perl) scripts in Notepad++ itself, rather than spawning a new window. So instead of using the builtin Notepad++ Run > Run, I install the NppExec plugin, and use Plugins > NppExec > Run, which will open up a console window embedded in Notepad++. Plus, NppExec gives the benefit of being able to do multi-line commands, so I can have it save the current file before running it, just in case I forgot to hit save before running. Or, when doing compiler-based rather than interpreter-based programming, I can have it save and compile and run, in one fell swoop.
Of course, maybe you’ve tried all of those. We cannot know, because you didn’t bother telling us what you tried, or what exactly the error was. Depending on what a “shell execute error” is, it might not even be unique to Notepad++ environment, and if you manually ran your script from a cmd.exe window, you might get the same error – in which case, you are asking a “cookie baking” question. The dearth of details makes it really hard for us to actually help you.
If my suggestions above don’t work for you, tell us exactly what you tried, and exactly what the behavior is when it didn’t work (copy/paste error messages, don’t just summarize them).
@PeterJones Hi Peter,
I tried using the same as mentioned by you. Even I learnt a lot of stuff from google, to how to solve the error but nothing helped. The issue is that after installation when i try to run the python program, it comes up with shell execute error.
would you mind to describe in detail what you are doing so that we can see where
your problem is?
I tried using the same as mentioned by you.
I mentioned multiple methods. Which did you use?
Even I learnt a lot of stuff from google, to how to solve the error but nothing helped.
“I tried some stuff” doesn’t help us help you.
The issue is that after installation
After installation of what?
when i try to run the python program,
How did you try to run it?
it comes up with shell execute error.
Where does this error occur? What is the exact phrasing of this error?
As I said, “If my suggestions above don’t work for you, tell us exactly what you tried, and exactly what the behavior is when it didn’t work (copy/paste error messages, don’t just summarize them).”
What you have just done is equivalent to phoning your doctor, saying “I hurt, fix me”; the doctor then asks you specific questions (“where do you hurt? what level of pain?”), and all you say in return in “I hurt, fix me”. The doctor then asks you to make an appointment, and you say “I hurt, fix me”. The doctor cannot help you if you won’t answer his questions and come in so he can physically examine you. Similarly, we cannot help you with your problem if you don’t tell us specifically what you are doing, and give us real error messages.
If you don’t want our help, you can keep giving us vague, one-to-three sentence replies. If you do want our help, you are going to have to provide more information. In the end, it’s up to you.
LOL… But really, it is a common problem here. People don’t want to put the effort into describing their problem. Sad.
But often the kind souls here will launch into a HUGE bit of typing, trying to guess at and solve ANY possible problem that COULD have gotten the OP into their situation. This is often A LOT of effort that I would rather see those folks put into some proper N++ documentation. ;)
Peter, I’d like to give you a +5. :)
Rereading my posting I kinda feel like Guy but with CAPS instead of bold. :)