<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I am currently work in to the internals of Notepad++ as a fresh user in<br />
this way. I use Windows 10 Pro 64-Bit Edition (20H2), and I have a problem with include external Python3 files.<br />
The files contains a mixed form of Notepad++ commands, and native Python commands. When I split of all of them, I can run it with a workaround, by using a batch file, and start it after F6-key press.<br />
With normal Python code, without Notepad++ commands, all done.<br />
With normal Notepad++ commands, without Python code (tkinter),<br />
I get error (like object “notepad” was not found), and the dialogs of<br />
tkinter will not shown.</p>
<p dir="auto">So I have to think, that Python external scripts does not harmony with<br />
Notepad++ commands.</p>
<p dir="auto">But now my question:<br />
Is it possible to bring up Notepad++ for Windows to handle such scripts,<br />
that can both - Full Python (tkinter) support, and full Notepad++ command<br />
support ?</p>
<p dir="auto">For example, I have add a little bit code, so that you can reproduce my<br />
point of concern:</p>
<pre><code>import datetime
import tkinter as tk

tk._test()

author   = "Jens Kallup - paule32"

now      = datetime.datetime.now()
today    = now.strftime("%Y/%m/%d %H:%M:%S")
year     = datetime.datetime.today()

filename = notepad.getCurrentFilename()
descr    = "No description available."
</code></pre>
<p dir="auto">you can see “filename” ? this will end up into error on F6 script start.<br />
and pure call in the Editor with a give short-cut key, end up with<br />
nothing hapend’s.<br />
I can’t see any error, warning, or information message, that the script<br />
could not be loaded or some other error occurs while running the<br />
Python script.</p>
<p dir="auto">I thank you all for giving hints, and solutions.<br />
I hope, I have give you enough Informations. Please feel free to ask<br />
when the one or other point is not clear or you don’t understand<br />
Thanks in adive !!!</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21529/python3-under-windows-10-pro-64-bit-include-external-script-dialogs-how</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 06:20:58 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21529.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jul 2021 20:56:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 15:31:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a> said in <a href="/post/68202">Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?</a>:</p>
<blockquote>
<p dir="auto">I don’t know why is that so,</p>
</blockquote>
<p dir="auto">The PythonScript documentation explains that you have to add it to the menu in order to make a shortcut.</p>
<p dir="auto">If that’s not enough of an explanation as to why: it’s because the Notepad++ Shortcut Mapper will only go as deep as Top Level &gt; Next Level &gt; Action for mapping a shortcut to the action; in this case, Top Level is <strong>Plugins</strong> and Next Level is <strong>Python Script</strong>, so an Action has to be in the Python Script level of the menu system for the Shortcut Mapper to be able to see it.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> ,</p>
<blockquote>
<p dir="auto">Complete, detailed, simply good.</p>
</blockquote>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68204</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68204</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 22 Jul 2021 15:31:15 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 15:05:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a></p>
<p dir="auto">Complete, detailed, simply good. I don’t know what more could be said now. Perfect.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68203</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68203</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 22 Jul 2021 15:05:13 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 14:52:53 GMT]]></title><description><![CDATA[<p dir="auto">Thank You very much.<br />
This information’s helps me to add PythonScript3 support for Notepad++ 8.1.2 64-Bit for Windows 10 Pro (H20H2).</p>
<p dir="auto">Note:<br />
When I create a “New Script”, this will let Notepad++ to save the .py file to:<br />
<strong>E:/Notepad++/plugins/Config/PythonScript/scripts/test2.py</strong></p>
<p dir="auto">This folder seems to be the “user” script directory.<br />
Because the “system” script folder differs from that.<br />
And as such, I have to “add” the “user” script(s) to the left side (system) listbox<br />
to make it possible to make a short-cut key for this script.<br />
I don’t know why is that so, but t works for me.</p>
<p dir="auto">When I restart Notepad++ 8.1.2, the script will be in the system script location<br />
and I can add a short-cut key with the key maper.</p>
<p dir="auto">Thank You very much !!!</p>
<p dir="auto">I hope this thread/post can help others, too, to setup Notepad++ 8.1.2 (16-07-2021)<br />
with Python3 and PythonScript.</p>
<p dir="auto">Greetings, Jens</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68202</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68202</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Thu, 22 Jul 2021 14:52:53 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 14:03:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a> said in <a href="/post/68198">Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?</a>:</p>
<blockquote>
<p dir="auto">so, I am out of my wisedom - what can I do?</p>
</blockquote>
<p dir="auto">Well, you haven’t understood or taken to heart what I previously said.  So I doubt what I say now will be understood either.</p>
<blockquote>
<p dir="auto">pip3 install npp</p>
</blockquote>
<p dir="auto">I don’t know for sure what gets downloaded if you run <code>pip3 install Npp</code>, but I assume that downloads and installs <a href="https://pypi.org/project/npp/" rel="nofollow ugc">this “npp” project listed on PyPI</a> – but that PyPI page tells me virtually nothing about that project, and when I manually looked into the .tar.gz, there appears to be nothing in that module.  So as far as I know, it has nothing to do with the Notepad++ PythonScript plugin.  Installing that module is likely to do <em>nothing</em> to solve your problem (and I think does nothing at all, because I see no actual Python code in that download).</p>
<p dir="auto">The Npp object that is distributed with the PythonScript plugin has hooks into the PythonScript.dll – that is, from what I understand, the Python package(s) cannot be separated from the compiled plugin, because it needs code from the compiled plugin to run.</p>
<p dir="auto">If you are using PythonScript 1.5.4 to run a script, you must use Python27.dll-compatible syntax.  If you use PythonScript 1.5.4 to launch an external process that runs an external python3.exe on the active file, then the active file must use python 3 syntax, and it will <em>not</em> have access to the PythonScript DLL interface – ie, it won’t have the Npp objects or the ability to control Notepad++'s UI or directly access the contents of the editor components in Notepad++.  I don’t know how else to say this, but I’ve been trying this whole conversation to help you understand this.</p>
<p dir="auto">If you want a Python 3 compatible script to have access to the internals of Notepad++, then you will need to remove PythonScript 1.5.4 plugin, and instead install the alpha version of PythonScript 3.0.8 plugin that was linked above.  That PythonScript 3.0.8 plugin provides its own python 3.9.4 interpreter (in the form of a DLL called python39.dll), and scripts that you write for that plugin are required to be in python3 syntax.  As <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> described earlier, with the PythonScript 3.0.8 plugin installed, it may then be possible to copy over the equal-version python39.dll from your normal python3 installation overtop of the python39.dll for the plugin, and then use <strong>Plugins &gt; PythonScript &gt; Configuration</strong>’s toggle “Prefer installed python libraries” checkbox on.  Once that is checked on, and you exit Notepad++ and re-start, then if I’ve understood the PythonScript documentation correctly, the interpreter run by PythonScript 3.0.8 should be able to see libraries that you’ve installed with pip3 into your normal Python 3 installation.  And thus you should be able to load tkinter as <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> showed in the early experiments.  I do not have an installed copy of Python3, so I cannot confirm that – but <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a>’s earlier post with the tkinter experiment .</p>
<p dir="auto">So, to reiterate in a simple step-by-step set of instructions<br />
0. Install your python3 and Notepad++ as normal (I assume this is already done, which is why I called it step 0).  The python3 installation will need to be python3.9.x</p>
<ol>
<li>Uninstall any existing PythonScript plugin, because they are likely the wrong one right now</li>
<li>Download the alpha version of PythonScript 3.0.8 from <a href="https://github.com/bruderstein/PythonScript/releases/tag/v3.0.8" rel="nofollow ugc">https://github.com/bruderstein/PythonScript/releases/tag/v3.0.8</a> – I recommend PythonScript_Full_3.0.8.0_x64_PluginAdmin.zip for a 64-bit Notepad++ – and unzip into your Notepad++ installation (based on the directories you show above, I think it will be the <code>E:\Notepad++\Plugins\PythonScript\</code> directory)</li>
<li>Start Notepad++, and verify that <strong>Plugins &gt; PythonScript &gt; About</strong> says v3.0.8 and uses python3.9.4<br />
<img src="/assets/uploads/files/1626961223544-eb5f33a5-2bd2-4f1f-8331-df5d1b088631-image.png" alt="eb5f33a5-2bd2-4f1f-8331-df5d1b088631-image.png" class=" img-fluid img-markdown" /></li>
<li>Run <strong>Plugins &gt; PythonScript &gt; Show Console</strong>, and try to <code>import tkinter</code> from that console.  It will probably say something like:<pre><code>&gt;&gt;&gt; import tkinter
Traceback (most recent call last):
  File "&lt;console&gt;", line 1, in &lt;module&gt;
ModuleNotFoundError: No module named 'tkinter'
</code></pre>
</li>
<li><strong>Plugins &gt; Python Script &gt; Configuration…</strong>
<ol>
<li>Change the <strong>Initialisation</strong> pulldown from <code>LAZY</code> to <code>AT STARTUP</code></li>
<li>Check the checkbox next to <code>☑ Prefer installed python libraries</code></li>
<li><strong>OK</strong> to exit Configuration dialog</li>
</ol>
</li>
<li>Exit Notepad++</li>
<li>Go into <code>E:\Notepad++\Plugins\PythonScript\</code> directory
<ol>
<li>Rename <code>python39.dll</code> to <code>python39.dll.original</code></li>
<li>Copy <code>python39.dll</code> from your normal python 3 installation (I presume from <code>E:\Python39\python39.dll</code>, based on the path to your python3 executable you mentioned earlier) and paste it into <code>E:\Notepad++\Plugins\PythonScript</code>
<ul>
<li>From what I understand from the Configuration… dialog text: <img src="/assets/uploads/files/1626962317554-2e762845-5a3b-4f6e-9860-ec8f7b844a81-image.png" alt="2e762845-5a3b-4f6e-9860-ec8f7b844a81-image.png" class=" img-fluid img-markdown" /><br />
… by copying the DLL from your installed python into the Plugins\PythonScript folder, the instance that PythonScript uses will now match your installed python, and will know about the standard search path for your installed python.  (This is where I’m a little unclear, but I think by using a different python39.dll, the default contents of <code>sys.path</code> list of directories to search will be different, giving preference to the pip3-installed libraries… but I’m not 100% certain on that.  <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> can correct me where I’ve got my python facts wrong.)</li>
</ul>
</li>
</ol>
</li>
<li>Start Notepad++, and verify that <strong>Plugins &gt; PythonScript &gt; About</strong> still says v3.0.8 , but now mentions your installed version of python 3.9.x.
<ul>
<li>In my example, I found a DLL for python3.9.6, so that will be obviously different from the 3.9.4 that came with PythonScript 3.0.8:<br />
<img src="/assets/uploads/files/1626961833514-34f2d780-dd62-47b5-ae8b-c572569a923b-image.png" alt="34f2d780-dd62-47b5-ae8b-c572569a923b-image.png" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1626961860670-9fed1f86-caf7-4697-967d-2001247f3e66-image.png" alt="9fed1f86-caf7-4697-967d-2001247f3e66-image.png" class=" img-fluid img-markdown" /><br />
Notice that the About dialog now shows Python 3.9.6, so it’s using the new DLL</li>
</ul>
</li>
<li><strong>Plugins &gt; PythonScript &gt; Show Console</strong>
<ol>
<li>should also show the updated DLL version in the console window.<pre><code>Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
Initialisation took 328ms
Ready.
</code></pre>
</li>
<li>If I’ve understood the documenation and <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a>’s example correctly, at this point, in the Console, you should be able to type <code>import tkinter</code>, and if tkinter is installed for your <code>e:\python39\</code> python, then it should load okay at this point, instead of giving an error.  (But, like I’ve said, I don’t have a full installation of python3, so I cannot use pip3 to install tkinter to verify that.)</li>
<li>If that’s true, then use **PythonScript a simple <a href="http://test1.py" rel="nofollow ugc">test1.py</a> script should work:<pre><code>from Npp import notepad, console
import datetime
import tkinter as tk
tk._test()
</code></pre>
And at this point, <strong>Plugins &gt; Python Script &gt; Scripts &gt; test1</strong> should work for you, and run a script that has access to both tkinter and the PythonScript notepad++ objects</li>
</ol>
</li>
</ol>
]]></description><link>https://community.notepad-plus-plus.org/post/68201</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68201</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 22 Jul 2021 14:03:06 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 13:00:46 GMT]]></title><description><![CDATA[<p dir="auto">now, I did following steps in mingw64 shell (msys64):</p>
<p dir="auto">step 1:</p>
<pre><code>devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ pip3 install npp
Requirement already satisfied: npp in /usr/lib/python3.8/site-packages (0.0.0.0a0.dev20210526)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
</code></pre>
<p dir="auto">step 2:</p>
<pre><code>devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ python3 -m venv tutorial-env
Looking in links: c:\Users\devlab1\AppData\Local\Temp\tmpogdw6g9l
Processing c:\users\devlab1\appdata\local\temp\tmpogdw6g9l\setuptools-49.2.1-py3-none-any.whl
Processing c:\users\devlab1\appdata\local\temp\tmpogdw6g9l\pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: setuptools, pip
Successfully installed pip-20.2.3 setuptools-49.2.1
</code></pre>
<p dir="auto">step 3:</p>
<pre><code>$ ls
Time.py  test1.py  test2.py  tutorial-env
</code></pre>
<p dir="auto">step 4:</p>
<pre><code>devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ ls tutorial-env/bin/
Activate.ps1          easy_install.exe  pip3.exe       python3.exe
activate              pip.exe           python.exe     python3w.exe
easy_install-3.8.exe  pip3.8.exe        python3.8.exe  pythonw.exe
</code></pre>
<p dir="auto">step 5:</p>
<pre><code>$ ./tutorial-env/bin/activate
</code></pre>
<p dir="auto">step 6:</p>
<pre><code>$ ./tutorial-env/bin/pip install --force-reinstall --no-cache-dir wheel
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
  Attempting uninstall: wheel
    Found existing installation: wheel 0.36.2
    Uninstalling wheel-0.36.2:
      Successfully uninstalled wheel-0.36.2
Successfully installed wheel-0.36.2
</code></pre>
<p dir="auto">step 7:</p>
<pre><code>$ ./tutorial-env/bin/pip install --force-reinstall --no-cache-dir Npp
Collecting Npp
  Downloading npp-0.0.0.0a0.dev20210526.tar.gz (1.0 kB)
Building wheels for collected packages: Npp
  Building wheel for Npp (setup.py) ... done
  Created wheel for Npp: filename=npp-0.0.0.0a0.dev20210526-py3-none-any.whl size=1366 sha256=32dfdda848022ac67ae37c1476dd119f7d5e8ad85abb89050224f0589683810f
  Stored in directory: C:/Users/devlab1/AppData/Local/Temp/pip-ephem-wheel-cache-e8zs4bz6/wheels/79/c1/16/6c406f5a8626c6aaafde87534c6b9b3b362fabde33701be030
Successfully built Npp
Installing collected packages: Npp
  Attempting uninstall: Npp
    Found existing installation: npp 0.0.0.0a0.dev20210526
    Uninstalling npp-0.0.0.0a0.dev20210526:
      Successfully uninstalled npp-0.0.0.0a0.dev20210526
Successfully installed Npp-0.0.0.0a0.dev20210526
</code></pre>
<p dir="auto">step 8:</p>
<pre><code>$ ./tutorial-env/bin/python3.exe
Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt;
</code></pre>
<p dir="auto">then I typed in the following line:</p>
<pre><code>import Npp
</code></pre>
<p dir="auto">and I get prompted with:</p>
<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ModuleNotFoundError: No module named 'Npp'
</code></pre>
<p dir="auto">After this all, I did following steps in <em>Windows</em> <strong>PowerShell</strong>:<br />
step 1:</p>
<pre><code>PS E:\&gt; cd Notepad++\plugins\PythonScript\scripts\paule32
PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt; .\tutorial-env\bin\Activate
(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt;
</code></pre>
<p dir="auto">step 2:</p>
<pre><code>(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt; .\tutorial-env\bin\pip install --force-reinstall --no-cache-dir wheel
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
  Attempting uninstall: wheel
    Found existing installation: wheel 0.36.2
    Uninstalling wheel-0.36.2:
      Successfully uninstalled wheel-0.36.2
Successfully installed wheel-0.36.2
(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt;
</code></pre>
<p dir="auto">step 3:</p>
<pre><code>(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt; .\tutorial-env\bin\pip install --force-reinstall --no-cache-dir Npp
Collecting Npp
  Downloading npp-0.0.0.0a0.dev20210526.tar.gz (1.0 kB)
Building wheels for collected packages: Npp
  Building wheel for Npp (setup.py) ... done
  Created wheel for Npp: filename=npp-0.0.0.0a0.dev20210526-py3-none-any.whl size=1366 sha256=13eccf36e448b597024d306a39db9511ec7ed29ca559474c0f5899bd76fde5e5
  Stored in directory: C:\Users\devlab1\AppData\Local\Temp\pip-ephem-wheel-cache-oz3f1eoe\wheels\79\c1\16\6c406f5a8626c6aaafde87534c6b9b3b362fabde33701be030
Successfully built Npp
Installing collected packages: Npp
  Attempting uninstall: Npp
    Found existing installation: npp 0.0.0.0a0.dev20210526
    Uninstalling npp-0.0.0.0a0.dev20210526:
      Successfully uninstalled npp-0.0.0.0a0.dev20210526
Successfully installed Npp-0.0.0.0a0.dev20210526
(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt;
</code></pre>
<p dir="auto">step 4:</p>
<pre><code>(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt; .\tutorial-env\bin\python3.exe .\test2.py
Traceback (most recent call last):
  File ".\test2.py", line 1, in &lt;module&gt;
    import Npp
ModuleNotFoundError: No module named 'Npp'
(tutorial-env) PS E:\Notepad++\plugins\PythonScript\scripts\paule32&gt;
</code></pre>
<p dir="auto">so, I am out of my wisedom - what can I do?<br />
Jens</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68198</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68198</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Thu, 22 Jul 2021 13:00:46 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Thu, 22 Jul 2021 11:51:57 GMT]]></title><description><![CDATA[<p dir="auto">ok, thank you very much of your reply.<br />
I could create the key shortcut , and I could execute external file <a href="http://Test1.py" rel="nofollow ugc">Test1.py</a> from <a href="http://Time.py" rel="nofollow ugc">Time.py</a><br />
this is <a href="http://Time.py" rel="nofollow ugc">Time.py</a>:</p>
<pre><code>from Npp import notepad, console

import subprocess
import shlex
import os

def run_command(command, __cwd):
    
    _startupinfo = subprocess.STARTUPINFO() 
    _startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    process = subprocess.Popen(shlex.split(command),
                               startupinfo=_startupinfo,
                               stdout=subprocess.PIPE, 
                               stderr=subprocess.PIPE, 
                               cwd=__cwd)
    _stdout, _stderr = process.communicate()
    
    console.show()
    if _stdout: console.write(_stdout)
    if _stderr: console.write(_stderr)

file = "E:/NotePad++/plugins/PythonScript/scripts/paule32/test1.py"
_cwd, _ = os.path.split(file)
run_command('"{}" -u "{}"'.format('E:/Python39/python.exe', file), _cwd)
</code></pre>
<p dir="auto">this is <a href="http://Test1.py" rel="nofollow ugc">Test1.py</a>:</p>
<pre><code>from Npp import notepad, console

import datetime
import tkinter as tk
tk._test()
</code></pre>
<p dir="auto">But now, I get Npp error at execute short-cut key:</p>
<pre><code>Traceback (most recent call last):
  File "E:\NotePad++\plugins\PythonScript\scripts\paule32\test1.py", line 1, in &lt;module&gt;
    from Npp import notepad, console
ModuleNotFoundError: No module named 'Npp'
</code></pre>
<p dir="auto">so, the Npp module ist installed.</p>
<p dir="auto">here my steps, I did:</p>
<pre><code>E:\NotePad++\plugins\PythonScript\scripts\paule32&gt;pip3 install npp
Requirement already satisfied: npp in e:\python39\lib\site-packages (0.0.0.0a0.dev20210526)

E:\NotePad++\plugins\PythonScript\scripts\paule32&gt;dir
 Datenträger in Laufwerk E: ist devlab1
 Volumeseriennummer: E0B0-DD56

 Verzeichnis von E:\NotePad++\plugins\PythonScript\scripts\paule32

21.07.2021  22:24    &lt;DIR&gt;          .
21.07.2021  22:24    &lt;DIR&gt;          ..
22.07.2021  12:39             2.591 test1.py
21.07.2021  22:33             3.512 Time.py
               2 Datei(en),          6.103 Bytes
               2 Verzeichnis(se), 472.926.322.688 Bytes frei

E:\NotePad++\plugins\PythonScript\scripts\paule32&gt;E:\NotePad++\plugins\PythonScript\scripts\paule32&gt;e:\Python39\python.exe -u time.py

Traceback (most recent call last):
  File "E:\NotePad++\plugins\PythonScript\scripts\paule32\time.py", line 5, in &lt;module&gt;
    from Npp import notepad, console
ModuleNotFoundError: No module named 'Npp'

E:\NotePad++\plugins\PythonScript\scripts\paule32&gt;
</code></pre>
<p dir="auto">after this, I test in mingw64 environment:</p>
<pre><code>devlab1@rk1700 MINGW64 ~
$ python3 -VV
Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]

devlab1@rk1700 MINGW64 /e/Notepad++
$ cd plugins/PythonScript/scripts/paule32/

devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ ls
Time.py  test1.py

devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ where python3
E:\msys64\mingw64\bin\python3.exe
E:\msys64\usr\bin\python3.exe

$ python3 -u time.py
Traceback (most recent call last):
  File "time.py", line 5, in &lt;module&gt;
    from Npp import notepad, console
ModuleNotFoundError: No module named 'Npp'

$ pip3 install npp
Collecting npp
  Downloading npp-0.0.0.0a0.dev20210526.tar.gz (1.0 kB)
Using legacy 'setup.py install' for npp, since package 'wheel' is not installed.
Installing collected packages: npp
    Running setup.py install for npp ... done
Successfully installed npp-0.0.0.0a0.dev20210526

$ pip3 install wheel
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.36.2

$ pip3 install npp
Requirement already satisfied: npp in /usr/lib/python3.8/site-packages (0.0.0.0a0.dev20210526)

devlab1@rk1700 MINGW64 /e/Notepad++/plugins/PythonScript/scripts/paule32
$ python -u time.py
Traceback (most recent call last):
  File "time.py", line 5, in &lt;module&gt;
    from Npp import notepad, console
ModuleNotFoundError: No module named 'Npp'

</code></pre>
<p dir="auto">I used <a href="http://Time.py" rel="nofollow ugc">Time.py</a> in notepad++ - Execute - F5:</p>
<p dir="auto">E:\Python39\python.exe $(FULL_CURRENT_PATH)</p>
<p dir="auto">with this code (file: <a href="http://test2.py" rel="nofollow ugc">test2.py</a>):</p>
<pre><code>#from Npp import notepad, console

import time

text = 'this is Python3 window, called from Notepadd++ 8.1.2'
print(text)
time.sleep(5)
</code></pre>
<p dir="auto">all works fine, exception when the first line outcomment: from Npp …<br />
then shell window will be open, and closed immedltly.</p>
<p dir="auto">I think all the need is Npp pip module, but I lost.<br />
Any ideas?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68195</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68195</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Thu, 22 Jul 2021 11:51:57 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 22:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a> said in <a href="/post/68177">Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?</a>:</p>
<blockquote>
<p dir="auto">I can’t add short cut for execute the script.</p>
</blockquote>
<p dir="auto">You can.  You have to use the <strong>Python Script &gt; Configuration</strong> dialog, and add your script to the “Menu Items” list on the middle-left of that dialog.  Then, after re-starting Notepad++, you can assign a keyboard shortcut to that entry using Shortcut Mapper.  That isn’t controlled by Notepad++, and has been true for all the years I’ve been using Python Script, and is documented in the Python Script help document (Python Script &gt; Context-Help &gt; Plugin Installation and Usage &gt; Usage)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68178</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68178</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 21 Jul 2021 22:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 21:35:54 GMT]]></title><description><![CDATA[<p dir="auto">ok, thank you. It work very well.<br />
But, I can’t add short cut for execute the script.<br />
I open the key mapper, but I can not add a “new item”<br />
I had this on notepad++ &lt; 8.1.2, but in current version, I missing the new line<br />
that is empty, when you double the last line.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68177</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68177</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Wed, 21 Jul 2021 21:35:54 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 20:04:40 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1626897589793-8b1625ce-645c-41cd-8e9d-9cc82620f9e5-image.png" alt="8b1625ce-645c-41cd-8e9d-9cc82620f9e5-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">I have made test_python3.py the active document and run StartWithLocalPython via a mapped F5 shortcut.<br />
There I selected my Python3 installation and then got the result in the PythonScript console.</p>
<p dir="auto">Instead the script test_python2.py can be executed directly from the script menu.</p>
<p dir="auto">I hope this makes it a bit clearer.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68172</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68172</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 21 Jul 2021 20:04:40 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 19:42:02 GMT]]></title><description><![CDATA[<p dir="auto">From the current discussion I get the impression that you think you can execute python3 script via the PythonScript interface, this is not true.<br />
Let me explain.</p>
<p dir="auto">PythonScript installed via the plugin admin installs, as Peter already said, Python2.7 and hence is only able to run Python2<br />
script via its menu interface. The StartwithLocalPython script is trick to start the python3 executable and provide the file<br />
currently used as a parameter. Means you have to execute always StartWithLocalPython and your script must be the current<br />
active one.</p>
<p dir="auto">Does this makes sense?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68168</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68168</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Wed, 21 Jul 2021 19:42:02 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 19:08:00 GMT]]></title><description><![CDATA[<p dir="auto">here you can see the problem that i have:<br />
<a href="https://imgur.com/UvSb7ML" rel="nofollow ugc">https://imgur.com/UvSb7ML</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/68165</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68165</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Wed, 21 Jul 2021 19:08:00 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 15:15:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a></p>
<blockquote>
<p dir="auto">StartupwithPython script</p>
</blockquote>
<p dir="auto">I had never looked at that script in the sample script folder before.  That’s something separate from what I’ve been describing.</p>
<p dir="auto">When you use <strong>Plugins &gt; Python Script &gt; Scripts &gt; namehere</strong>, it will run that <code>namehere.py</code> script using the plugin’s python27 interpreter, and any libraries that the DLL can see (which includes all the overhead for the Npp objects).</p>
<p dir="auto">If you use <strong>Plugins &gt; Python Script &gt; Scripts &gt; Samples &gt; StartWithLocalPython</strong>, then it will launch a new process using the specified python executable (and the libraries that <em>it</em> can see, which <em>don’t</em> include the Npp objects) and send the currently-active file to that python process.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68156</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68156</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 21 Jul 2021 15:15:10 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 15:03:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a> said in <a href="/post/68150">Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How?</a>:</p>
<blockquote>
<p dir="auto">How does notepad++ find Python2.7 .exe path?</p>
</blockquote>
<p dir="auto">It doesn’t.  As I said before, PythonScript 1.5.4 comes bundled with a python27.dll – which it stores alongside the plugin’s PythonScript.dll – it uses this DLL for running the python code; it doesn’t use a .exe at all.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68155</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68155</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 21 Jul 2021 15:03:57 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 14:49:47 GMT]]></title><description><![CDATA[<p dir="auto">ok, I download the portable version 8.2.1 version 64-bit for windows 10 pro<br />
from 16.07.2021.<br />
All gone. PythonScript could be successfully re-install.<br />
But I have a problem, yet.<br />
How does notepad++ find Python2.7 .exe path?<br />
I set the global PATH environment variable to the directory E:\Python39\  , so notepad++<br />
should be find python.exe in there.<br />
I modified the StartupwithPython script, close all windows, re-start notepad++, but<br />
I have no success. Is the path hard coded into the source ?</p>
<pre><code># -*- coding: utf-8 -*-
from Npp import notepad, console
import subprocess
import shlex
import os

def run_command(command, __cwd):
    
    _startupinfo = subprocess.STARTUPINFO() 
    _startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    process = subprocess.Popen(shlex.split(command),
                               startupinfo=_startupinfo,
                               stdout=subprocess.PIPE, 
                               stderr=subprocess.PIPE, 
                               cwd=__cwd)
    _stdout, _stderr = process.communicate()
    
    console.show()
    if _stdout: console.write(_stdout)
    if _stderr: console.write(_stderr)


file = notepad.getCurrentFilename()
_cwd, _ = os.path.split(file)
run_command('"{}" -u "{}"'.format('E:\\Python39\\python.exe', file), _cwd)
</code></pre>
<pre><code>Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)]
Initialisation took 78ms
Ready.
Traceback (most recent call last):
  File "E:\NotePad++\plugins\PythonScript\scripts\Samples\StartWithLocalPython.py", line 2, in &lt;module&gt;
    from Npp import notepad, console
ModuleNotFoundError: No module named 'Npp'
</code></pre>
<p dir="auto">and this is my windows console (cmd.exe) output:</p>
<pre><code>C:\Users\devlab1&gt;python -V
Python 3.9.1

C:\Users\devlab1&gt;python -VV
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)]

C:\Users\devlab1&gt;pip install npp
Collecting npp
  Downloading npp-0.0.0.0a0.dev20210526.tar.gz (1.0 kB)
Using legacy 'setup.py install' for npp, since package 'wheel' is not installed.
Installing collected packages: npp
    Running setup.py install for npp ... done
Successfully installed npp-0.0.0.0a0.dev20210526

C:\Users\devlab1&gt;
</code></pre>
<p dir="auto">You can see the different file date versions?<br />
Can you check this please ?<br />
Can you assists me, to bring up PythonScript running?</p>
<p dir="auto">I wonder me, why you write about PythonScript.dll, and python27.dll.<br />
I could not be change any settings - or did I wrong?</p>
<p dir="auto">Thanks Jens</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68150</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68150</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Wed, 21 Jul 2021 14:49:47 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Wed, 21 Jul 2021 12:52:00 GMT]]></title><description><![CDATA[<p dir="auto">when I install PythonScript, notepad++ closed itself, and open it again.<br />
after this, I get access violation error in loading time of the plugin.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68143</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68143</guid><dc:creator><![CDATA[Jens Kallup]]></dc:creator><pubDate>Wed, 21 Jul 2021 12:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Tue, 20 Jul 2021 21:20:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a></p>
<p dir="auto">You don’t say what <code>F6</code> is mapped to for you.  A default instance of Notepad++ has no command mapped to <code>F6</code>.  If you have the NppExec plugin installed, that’s the default shortcut for NppExec’s <strong>Execute NppExec Script</strong> command.  You don’t tell us that’s the case for you, but I will assume so.</p>
<p dir="auto">To have a python script have access to the Notepad++ application through the PythonScript library, you <em>must</em> run it from inside PythonScript, not by starting an external process.  Anything else will <em>not</em> work.  So spawning out through NppExec (or equivalent) to run an external python.exe process will <em>not</em> have access to the PythonScript hooks, like <code>from Npp import console,notepad,editor</code></p>
<p dir="auto">The PythonScript v1.5.4 (most recent version in Notepad++'s Plugins Admin tool) includes a Python 2.7.18 interpreter (via DLL).  So you cannot include python3 files or libraries from PythonScript 1.5.4.</p>
<p dir="auto">There is an alpha version of PythonScript 3.0.x available for download from GitHub, which embeds a python3 interpreter (as of today, it looks like <a href="https://github.com/bruderstein/PythonScript/releases/tag/v3.0.8" rel="nofollow ugc">3.0.8 is the most recent alpha version</a>).  With that, you can <s>strike out what I was typing, because it likely had inaccuracies</s> follow <a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a>;s instructions for external libraries.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68128</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68128</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 20 Jul 2021 21:20:01 GMT</pubDate></item><item><title><![CDATA[Reply to Python3 under Windows 10 Pro 64-Bit: include external script Dialogs, How? on Tue, 20 Jul 2021 21:19:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jens-kallup" aria-label="Profile: Jens-Kallup">@<bdi>Jens-Kallup</bdi></a></p>
<p dir="auto">yes, this can be realized.</p>
<p dir="auto"><img src="/assets/uploads/files/1626815647857-1eeb3d44-06d8-43a8-8dd2-93aa01a4520d-image.png" alt="1eeb3d44-06d8-43a8-8dd2-93aa01a4520d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">However, there are a few things to keep in mind.<br />
A) So that the notepad object can be accessed, there must be a plugin that makes this available. This is PythonScript.<br />
The standard version is Python 2.7, but there is also a beta version which is, I think, Python 3.9 at the moment.<br />
B) To be able to access modules that should be installed via pip, you have to set in the PythonScript configuration,<br />
that the local Python installation is preferred. The Pluing PythonScript cannot (yet) handle pip.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68127</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68127</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Tue, 20 Jul 2021 21:19:09 GMT</pubDate></item></channel></rss>