Scripts from Notepad++ do not run in Python/Jupyter 3.5(already read prior help discussions)
-
it isn’t the NppExport but the NppExec plugin.
$(FULL_CURRENT_PATH) evaluates to the file path only if the current
document has been saved already otherwise it would return something
like new … which of course cannot be found.Concerning your call
cmd /K D:\Python35\python.exe -i -c “execfile(‘$(FULL_CURRENT_PATH)’)"
You normally would do it rather like this
cmd /K D:\Python35\python.exe -i "$(FULL_CURRENT_PATH)"
Cheers
Claudia -
Thank you very much for the help but I am still getting the same response from Python (it opens the black python window with the following message: The device is not ready) after I followed your instructions of installing the NppExec plugin and placing this command in the run bar of notebook: cmd /K D:\Python35\python.exe -i “$(FULL_CURRENT_PATH)”.
Do you know how to fix this?
Scott
-
OK - step by step.
- right-click on the tab of your current script and select Full File Path to Clipboard
- open a cmd
- type in **cmd /K D:\Python35\python.exe -i ** and paste the content of the clipboard
- enter
does this work? What exactly happens?
If you installed nppexec - press F6
Does the nppexec dialog open?Cheers
Claudia -
Note,
type in **cmd /K D:\Python35\python.exe -i ** and paste the content of the clipboard
without the asteriks of course.
Cheers
Claudia -
Thank you again for the help. However it still doesn’t work
When I follow the steps 1-4 this is the result: I right clicked the tab of my current script and selected full file path to clipboard. I then opened a command prompt and typed in cmd /K D:\Python35\python.exe -I. I received the same message that I had before, “The device is not ready”. I stopped at this point.
If I press f6 then a dialogue box opens that contains my scripts from the page. When I click ok for this to execute it opens a box at the bottom of the page that contains an endless loop of error messages. This script is from a university course so shouldn’t have this output.
Do you know how to fix this?
Scott
-
When I follow the steps 1-4 this is the result: I right clicked the tab of my current script and selected full file path to clipboard. I then opened a command prompt and typed in cmd /K D:\Python35\python.exe -I. I received the same message that I had before, “The device is not ready”. I stopped at this point.
But then it means that you did not install python to D:\python35, didn’t you?
. When I click ok for this to execute it opens a box at the bottom of the page that contains an endless loop of error messages.
Which error is it?
Cheers
Claudia -
Good point Claudia. When I installed Python through the Anaconda program it saved it to C:\Users\myname\Anaconda3.
The error messages that I get at the bottom of the page when I run this script in the nppexec dialog box is:
“CreateProcess() failed with error code 2:
The system cannot find the file specified.”Do you know how to fix this?
Thank you very much for the help
Scott
-
depends what exactly is used in nppexec dialog.
Normally something like thiscd C:\Users\myname\Anaconda3\ python "$FULL_CURRENT_PATH”
Cheers
Claudia -
I greatly appreciate all of your help and patience but still cannot get it to work.
Scott
-
Scott, you need to be more descriptive what you get
and/or what isn’t working.
Maybe include a Screenshot (upload to e.g imgur) and use the syntax like![](LINK_OF_YOUR_IMAGE)
to embed it in a post.
Cheers
Claudia -
In the run box in notepad++ I have placed the following commands:
- cd C:\Users\myname\Anaconda3\python "$FULL_CURRENT_PATH”
- cmd /K C:\Users\myname\Anaconda3\python.exe -i “$(FULL_CURRENT_PATH)”
- cmd /K C:\Users\myname\Anaconda3\python "$FULL_CURRENT_PATH”
- cmd /K C:\Users\myname\Anaconda3\python "$(FULL_CURRENT_PATH)”
On all 4 of these tries python opened up with a message stating “the system cannot find the path specified.” I would greatly appreciate it if you have any additional suggestions on how to get this to work.
Scott
-
Sorry, you cannot get the same error message on all 4 runs.
The message “the system CANNOT find the path specified.” is descriptive isn’t it.I start thinking you are trolling.
Cheers
Claudia -
Your right. 1. from above doesn’t give me the same output as the others but just shows “run…” in the dialogue box. It was sloppy of me to post that.
I am a novice at programming, not a troll. I am trying to learn programming. I can understand if you run out of patience trying to help me with this as the amount of times that I have tried to fix this is also trying my patience. I did not plan on spending since yesterday trying to get notepad++ to communicate with python but rather to learn how to use python. Can you suggest any basic resources that I can look at to learn how to fix this?
Thanks for all of your help
Scott
-
Scott, we can get this work in maybe 2-3 posts if you would describe step by step what you do
instead of writing “I did what you do”, because any slight modification could break it.What do you want to do?
I assume you want to run python with the current script you have open with notepad++.
What do you use to execute the script?
I assume you use the Run dialog from the run menu and not the nppexec plugin.
I would suggest you use the nppexec plugin.-
Find out where your python.exe is located. We need to know the directory.
-
Press F6 to open the nppexec dialog
-
put the the following into the dialog opened by pressing F6
cd PATH_OF_THE_DIRECTORY_WHERE_YOUR_PYTHON_EXE_IS
python “$(FULL_CURRENT_PATH)” -
Press ok
A console opens and either shows the expected result or an error.
If an error appears copy it and post it then we see what is going on.
Do not interpret it - copy the real output.
If there is sensitive data in it - replace it with question marks - but only that part.Cheers
Claudia -
-
@scott-grossberg as you are a beginner, I suggest you to remove Anaconda and install the official python https://www.python.org/
-
Here is my solution.
-
uninstall anaconda
-
install python 3.6 in c:\python36
-
do an “hello world” script to test
4 append to the end of script os.system(“pause”) in order to pause your script and be able to read the resultimport os
print(“Hello World”)
os.system(“pause”)
5 run your script with “notepad++ run” command
C:\python36\python.exe "$(FULL_CURRENT_PATH)"
Here is what i got
screenshot -
-
@scott-grossberg any news ?
-
I followed your suggestion of removing anaconda and installing python directly and I can run notepad++ scripts in python (I tested this with the hello world program). Unfortunately the class that I am using this for has extra formatting in the scripts since they were saved as a python notebook. Therefore I get an error message when I try to run these scripts with notepad++ with my current set up. This is the error message:
C:\Anaconda\python.exe “C:\Users\scott grossberg\Downloads\controlflow_demo_test”
Process started >>>
Traceback (most recent call last):
File “C:\Users\scott grossberg\Downloads\controlflow_demo_test”, line 21, in <module>
“execution_count”: null,
NameError: name ‘null’ is not defined
<<< Process finished. (Exit code 1)I placed the command below into the run box (I saved Anaconda to C:\Anaconda) as well as within the box when I hit the f6 key and it successfully runs the hello world program above in python and the lower console box respectively:
C:\Anaconda\python.exe “$(FULL_CURRENT_PATH)”
Do you know how I can get the notepad++ script to run in the jupyter notebook?
Thank you very much for the help.
Scott
Thank you very much for the help.================ READY ================
-
I should have mentioned in the above post that after I successfully installed and tested the notepad++ and the python 3.6 integration I removed python 3.6 and re-installed Anaconda. I did this to try to get notepad++ to run the scripts in the python notebook rather than directly on python.
I greatly appreciate all of your help.
Scott
Scott
-
Sorry I don’t know Jupiter and I didn’t understood your issue.