I have notepad++ installed on win7, and have installed the notepad++ exec plugin. Whenever I execute the .py script I am running, i get the following error:
C:/Python27/python.exe ""
Process started >>>
C:\Python27\python.exe: can't find '__main__' module in ''
<<< Process finished.
================ READY ================
My index.py script is as follows:
text = "Hello World"
print text
The Notepad++ execute script (F6) is as follows:
C:/Python27/python.exe "$(C:/Python27/python.exe)"
This is the correct path to python.exe on my system. In the windows environmental variables, I have also added this to the PATH. Also, I have booted up the python.exe command prompt and have gotten the script to work by manually typing it in. I have done a directory search of C:/Python27, and the main.py file exists.
What is going on that is wrong here? Why can’t python find the __ main __ module??
EDIT:
Nevermind this, I’m an idiot.
So I had misinterpreted the setup for the notepad++ exec (F6) script:
C:/Python27/python.exe "$(C:/Python27/python.exe)"
It should have been this instead:
C:/Python27/python.exe "$(FULL_CURRENT_PATH)"
Of course it couldn’t find the main.py file because it wasn’t going to FULL_CURRENT_PATH.
Carry on.
Basically, it’s because the 1st argument in your script has been missinterpreted.
That is to say, with the code
You’re doing something roughly equivalent
What you need to use is:
Note: Don’t substitute “$(FULL_CURRENT_PATH)” for something else – put that in verbatim – it’s a predefined variable of the NppExec plugin. It may be considered shorthand for the full-path of the file in the currently open tab.
When I execute the script above (on a file called tmp.py, in my c:\xampp\htdocs\enhzflep folder), I get this displayed in the console:
Which is just fine, since I don’t have python installed on this machine. 🙂
EDIT: Just saw your edit. It seems I’m the greater fool!