<?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[Version of Python in script]]></title><description><![CDATA[<p dir="auto">As a NPP learner and a fairly experienced Python user, I started to  learn  writing NPP scripts.  Via “Plugins Admin” I installed “Python Script”.  Because I  have a standard installation of Python 3.9.2 on my Windows 10 desktop  I hoped that “Python Script” would use this 3.9.2 installation. However,  my very first NPP script tells me that it is using Python 2.7.18. (This is confirmed by the Python Script Configuration Panel, which I only discovered while writing  this message).  As you well know there are some significant incompatibilities between Python 2 and Python 3.</p>
<p dir="auto">So my question is: Is it possible to hack the plugin so that it will use my existing Python 3 installation? My version of NPP is 8.1.9.2</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22232/version-of-python-in-script</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 10:31:38 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22232.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Dec 2021 13:57:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Version of Python in script on Wed, 05 Jan 2022 10:16:19 GMT]]></title><description><![CDATA[<p dir="auto">Earlier I posted a simple calculator script which is based on Python 2.7. In Python 2.7 an integer division yields an integer (as in Fortran). In Python 3 this was changed to yield a float. If the Python 3 behavior is wanted, one must add to the top of the script:  <code>from __future__ import division</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/72651</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/72651</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Wed, 05 Jan 2022 10:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to Version of Python in script on Tue, 28 Dec 2021 16:22:48 GMT]]></title><description><![CDATA[<p dir="auto">Earlier I wrote that in my Kedit/Rexx days I often used a simple calculator macro and that I liked to share a very simple Python script, which indeed is as short and compact as its Rexx equivalent. Further I wrote that as a complete Npp noobie it took me about 2 hours to write it and assign it to a key combination. I’m very happy with Npp and its Python plugin. Now I present a small update to the same script:</p>
<pre><code>"""
    -- Simple calculator for use under Notepad++.
    
    Select text that contains a valid Python arithmetic expression
    and execute this script. 
    
    Result is inserted between selected text and text following it.
    
    I assigned the script to the key combination: `Alt+Num +`
    
    Sample expression: (-(1.0 + 2) * 3 + 55.0) / (8**2) = 0.71875
"""
from Npp import *

expression = editor.getSelText() 
if len(expression) == 0:
    notepad.messageBox('No expression selected') 
else:    
    try:
        answer = str(eval(expression))
    except SyntaxError as err: 
        console.write(err.args[0]+": "+err.args[1][3]+"\r\n")
        editor.addText(' *Error* ')
    else:    
        editor.addText(' = ' + answer)
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/72409</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/72409</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Tue, 28 Dec 2021 16:22:48 GMT</pubDate></item><item><title><![CDATA[Reply to Version of Python in script on Tue, 07 Dec 2021 15:14:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</a> said in <a href="/post/71938">Version of Python in script</a>:</p>
<blockquote>
<p dir="auto">There is an alpha version of PythonScript which uses a bundled Python 3 DLL instead of a bundled Python 2 DLL – just look at the releases page and grab the most recent alpha.</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@Paul-Wormer</a></p>
<p dir="auto">I’ve been using the <a href="https://github.com/bruderstein/PythonScript/releases/tag/v3.0.7" rel="nofollow ugc">Python Script v3.0.7</a> for some time now and it works great.  The plugin finds your system python libraries in its search path.  But as <a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> says this is primarily for automating N++ with Python.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71940</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71940</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 07 Dec 2021 15:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Version of Python in script on Tue, 07 Dec 2021 15:11:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@peterjones</a><br />
Thank you for your swift answer. I will look at the alpha.</p>
<p dir="auto">I’m sorry for not expressing myself more clearly: I’m not looking for a Python IDE.  The point is, I like to work with a personalized editor. For many years I worked with IBM-CMS/Xedit and MS/Kedit and over the years I wrote many, many edit macros in Rexx.</p>
<p dir="auto">I have no longer access to Xedit and gave up on Kedit, because, unfortunately, it does not support Unicode. So, what I’m looking for, really, is a replacement for my beloved Kedit/Rexx and I hope to find it in the tandem Notepad++/Python. (I will keep on running Python from the cmd line.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71939</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71939</guid><dc:creator><![CDATA[Paul Wormer]]></dc:creator><pubDate>Tue, 07 Dec 2021 15:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to Version of Python in script on Tue, 07 Dec 2021 14:38:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/22926">@paul-wormer</a> ,</p>
<p dir="auto">There is an alpha version of PythonScript which uses a bundled Python 3 DLL instead of a bundled Python 2 DLL – just look at the <a href="https://github.com/bruderstein/PythonScript/releases" rel="nofollow ugc">releases page</a> and grab the most recent alpha.</p>
<p dir="auto">But maybe you are misunderstanding the purpose of PythonScript plugin.  It is not primarily for doing your “normal” Python programming.  For that, you don’t need the plugin, you just type Python in Notepad++ as normal, and then run your script using your own Python interpreter – you can use a plugin like NppExec to run the script in a console inside Notepad++ itself if that’s what you like, but you don’t even need that.</p>
<p dir="auto">The purpose of the PythonScript is for automating Notepad++ – like macros, but on steroids: it is using Python 2 as the scripting language for controlling Notepad++.  So you’re really just using the Python 2 for the “glue language” for accessing the methods on the notepad and editor objects that they provide.  So any differences in syntax would have minimal impact on your pythonscript scripts for NPP.  Though, admittedly, sometimes it’s the small differences between what you’re used to and what you have available that make the most annoyances.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/71938</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/71938</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 07 Dec 2021 14:38:00 GMT</pubDate></item></channel></rss>