Pythonscript plugin / console not working
-
@Fuel-DZN said in Pythonscript plugin / console not working:
@Mark-Olson Can it do multiple files at once? I also can’t quite figure out how to divide with it.
The Search in indicated region function in Columns++ only works on a region (which can be the entire file) in the active tab. The initial motivation for this function was to be able to search within a rectangular selection. It is unlikely that I’ll extend it to processing multiple tabs or files at once, since the notion of an “indicated region” wouldn’t make sense in that context.
If I’m following the intent of your Python, you would want:
Find what :
(?<=development = )\d+
Replace with :(?=ceil(this/2))
-
@Coises Thank you, I didn’t see that - it works now.
Since I need it for multiple files, I used this, but it doesn’t work:
from Npp import * import math def divide_2(m): return str(int(float(math.ceil((float(m.group(1)) / 2))))) for (filename, bufferID, index, view) in notepad.getFiles(): notepad.activateBufferID(bufferID) print(notepad.getCurrentFilename() editor.rereplace(r'(?<=development = )(\d+)', divide_2); notepad.save()
If anyone with experience in python (or an eye for typos) sees what’s wrong with this please let me know. (I’m not sure if I’m supposed to create a new post for this.)
-
@Fuel-DZN said in Pythonscript plugin / console not working:
print(notepad.getCurrentFilename()
unbalanced parentheses. It should be
print(notepad.getCurrentFilename())
-
OP really needs to get the console window working, because if other forum members have to spot such simple typos as
print(notepad.getCurrentFilename()
then we’ve got a problem… -
@Fuel-DZN said,
‘Show Console’ would be on in the plugin menu but nothing is visible
Can you show a screenshot of the Plugins > Python Script menu, showing the checkmark really is on the Show Console entry?
Also, I think you should read the FAQ on Find Results – don’t be confused: that FAQ focuses on the Search Results window, but all the information about docking (where the docking resize are when a docked panel is tiny, or resetting the docking by editing the config file) are applicable to the PythonScript console as well, since it uses the same docking interface as other panels. (The only thing that’s not applicable from that FAQ is that F7 won’t toggle you to get into the PythonScript console panel, unlike the Search Results)
-
@PeterJones said in Pythonscript plugin / console not working:
Can you show a screenshot of the Plugins > Python Script menu, showing the checkmark really is on the Show Console entry?
-
Can you take the same screenshot but with the whole npp window?
-
@Ekopalypse said in Pythonscript plugin / console not working:
Can you take the same screenshot but with the whole npp window?
While you’re at it, also File > Open
%AppData%\Notepad++\config.xml
, search forGUIConfig name="DockingManager"
and then copy the DockingManager section from that file, paste it into your reply, select it and click the</>
toolbar button in the forum edit-your-post window, which will make it look something like this in your post:<GUIConfig name="DockingManager" leftWidth="200" rightWidth="200" topHeight="200" bottomHeight="200"> <PluginDlg pluginName="Notepad++::InternalFunction" id="42052" curr="0" prev="-1" isVisible="yes" /> <PluginDlg pluginName="Notepad++::InternalFunction" id="44084" curr="1" prev="-1" isVisible="yes" /> <PluginDlg pluginName="Notepad++::InternalFunction" id="44080" curr="3" prev="-1" isVisible="yes" /> <ActiveTabs cont="0" activeTab="0" /> <ActiveTabs cont="1" activeTab="0" /> <ActiveTabs cont="2" activeTab="-1" /> <ActiveTabs cont="3" activeTab="0" /> </GUIConfig>
That section will tell us whether the problem was, as I suspected, that you have just shrunk your PythonScript console panel too small for you to notice. (Please note, the FAQ I linked you to above already told you to go looking in that file, and told you how to reset that section so that it will likely fix your problem; given your lack of mention in your reply, I am going to assume that you didn’t notice that piece of advice from my previous post.)
-
Sorry for the late reply.
<GUIConfig name="DockingManager" leftWidth="247" rightWidth="200" topHeight="373" bottomHeight="0"> <FloatingWindow cont="4" x="13" y="173" width="1635" height="966" /> <PluginDlg pluginName="Notepad++::InternalFunction" id="44070" curr="0" prev="-1" isVisible="yes" /> <PluginDlg pluginName="Python Script" id="-1" curr="3" prev="-1" isVisible="yes" /> <PluginDlg pluginName="Notepad++::InternalFunction" id="0" curr="2" prev="4" isVisible="no" /> <PluginDlg pluginName="Notepad++::InternalFunction" id="44084" curr="1" prev="-1" isVisible="no" /> <PluginDlg pluginName="NppExec.dll" id="5" curr="3" prev="4" isVisible="yes" /> <PluginDlg pluginName="Explorer.dll" id="0" curr="0" prev="-1" isVisible="no" /> <ActiveTabs cont="0" activeTab="0" /> <ActiveTabs cont="1" activeTab="-1" /> <ActiveTabs cont="2" activeTab="-1" /> <ActiveTabs cont="3" activeTab="-1" /> </GUIConfig>
(Indentation is messed up but I don’t know how to fix that.)
I tried the FAQ suggestions which did not solve it.
In case it is helpful, earlier I said:
When when I activate it after opening n++ I see something very briefly flash but that’s it.
-
<GUIConfig name="DockingManager" leftWidth="247" rightWidth="200" topHeight="373" bottomHeight="0">
I tried the FAQ suggestions which did not solve it.
Do you see that
bottomHeight="0"
? That is the culprit, and the FAQ explains how to fix it.Also, the up-down arrow in the right place would have fixed it also. This gap from your screenshot is exacty the gap I was referencing in the FAQ. I have added the arrow to show you where to hover your mouse cursor to find it.
-
@PeterJones Thank you, resizing the panel just fixed it. I don’t know why it didn’t work before.