Save as [type] lacks an option for .py (python) file
-
When I try to save a script I coded in Python, the drop-down menu for Save as [file type] lacks the option to save as .py (Python). The following is an image that is a composite of 3 images (of the drop-down list) to show that the option to save as a .py file is missing:
I’d appreciate any suggestions about how to fix that.
Thanks,
Marcp.s. My debug info is as follows:
Notepad++ v8.5.3 (64-bit)
Build time : May 15 2023 - 06:09:36
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : “E:\Apps\UtilitiesByMarc\Vbs.RarTo__Archive_Nu.vbs”
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.3086
Current ANSI codepage : 1252
Plugins :
MenuIcons (2)
mimeTools (2.9)
NotepadStarterPlugin (2.3.3)
Npp-Highlighter (1.0.0.1)
NppBplistPlugin (1.3)
NppConverter (4.5)
NppExec (0.8.2)
NppExport (0.4)
NppMenuSearch (0.9.6)
NppPluginDemo (4.3)
NppPluginTemplate (4.3)
NppRegExTractorPlugin (2.1)
NppSnippets (1.7.1)
NppTaskList (2.5)
NppXmlTreeviewPlugin (2)
pork2sausage (2.3)
PreviewHTML (1.3.2)
Python Indent (1.0.0.4)
PythonScript (2)
QuickText (0.2.5.1)
RandomValuesNppPlugin (0.2.1)
RegexTrainer (1)
Remove Duplicate Lines (1.3)
XMLTools (3.1.1.13)
_CustomizeToolbar (5.3) -
That is indeed strange.
What does the status bar say in the first field when you have a Python file open?
-
@Marc-Hankin said in Save as [type] lacks an option for .py (python) file:
I’d appreciate any suggestions about how to fix that.
Fix
langs.xml
(for you, it’s in%AppData%\Notepad++\langs.xml
🛈, since your DebugInfo shows a normal installation). You can compare to C:\Program Files\Notepad++\langs.model.xml to see what the “python” entry should look like.Details: Notepad++ creates the SaveAs-type list from
langs.xml
, and lists the languages in the same order that they are found inlangs.xml
(hence they aren’t always alphabetical). If you have any Settings > Style Configurator > Language:Python
entries in the User ext block, those will be included in the list of extensions filtered in the SaveAs-type list (hence @Ekopalypse’s shows some extra extensions compared to the two default*.py;*.pyw
that are normally shown)
-
@PeterJones @Ekopalypse When I opened an existing Python file, the following was in the status line:
“Python file length:10,816 lines:351 Ln:1 Col:1 Pos:1 Windows (CR IF) UTF-8 INS”
By the way, this was after I had [1] compared the langs.xml files, [2] found a lot of differences, [3] but found that the Python language section appeared in my user XML too, and [4] impetuously copied everything from the C:\Program Files\Notepad++\langs.model.xml into my user XML, C:\Users\marc\AppData\Roaming\Notepad++\langs.xml, so that the two files are now identical. But Python still does not appear as an option when I am saving a new file.
-
@Marc-Hankin said in Save as [type] lacks an option for .py (python) file:
But Python still does not appear as an option when I am saving a new file
Assuming you restarted Notepad++ after making the changes to
langs.xml
(since it cannot know about the changes until it restarts), my next suggestion would be to download the “portable zip” from the official download site, unzip it into a known directory (maybe onto your desktop); exit your normal Notepad++ and run from the portable directory. See if that one works.If it does, then my next guess would be that one of your plugins is somehow messing with that list. Try running your installed notepad++ with command line argument
-noPlugin
, which will run without any plugins; if that causes your normal installed Notepad++ to give Python as a possible choice, then it’s definitely one of your plugins, and you can try to disable one plugin at a time to find the culprit. (The-noPlugin
and one-plugin-at-a-time procedures are described in this FAQ section.) -
I have Npp 853 portable 32bit and python file type is present into the menu with two file estensions.
Screenshot follows
Not sure, but maybe original files got corrupted for some reason. Perhaps you could download a portable version of npp, extract from the compressed archive the files that are not working and replace the originals with the new ones?
-
@PeterJones said in Save as [type] lacks an option for .py (python) file:
Notepad++ creates the SaveAs-type list from langs.xml
I wish we could add our own entries to it. I have custom extensions I’d like to have in the Save As list eg: XYplorer and AutoHotkey.
-
@deleelee said in Save as [type] lacks an option for .py (python) file:
@PeterJones said in Save as [type] lacks an option for .py (python) file:
Notepad++ creates the SaveAs-type list from langs.xml
I wish we could add our own entries to it. I have custom extensions I’d like to have in the Save As list eg: XYplorer and AutoHotkey.
That’s a great idea. The natural implementation would be for Notepad++ to include the extensions listed in all loaded User Defined Languages in addition to the native language file extensions (and the user-supplied “User ext.” for those native langauges) that it already lists. Unfortunately, it doesn’t do that, and my request from Jan 2022 has sat idle without any developer taking it on. Maybe if someone (hint hint) were to go say that they really wanted this feature, too, it might encourage a developer to gain an interest in it.
-
@PeterJones said in Save as [type] lacks an option for .py (python) file:
The natural implementation would be for Notepad++ to include the extensions listed in all loaded User Defined Languages in addition to the native language file extensions
I agree 100% and have added my support to your request. I also think we should be able to add file extensions for languages we don’t have UDLs for, and I’ve mentioned that as well.