-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
IDLE: Document SaveAs dialog extension handling #65802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In IDLE, edit and save a file foo.py. |
There are known differences among the various Tk implementations with regard to how file extensions are handled in Tk file dialogs, like IDLE uses; see bpo-4832. Can you say which version of Tk was in use (it should be in the About IDLE display) and on what platform? I was not able to reproduce this behavior on any of the current OS X IDLEs and Tks with Save As. |
On Win 7, I also see x.py in the save dialog, both 2.7 and 3.4 as installed. |
I agree that having .py not visible but written would be obnoxious. Hoever, without more information, I am inclined to close this as a 3rd parth (OS) issue. Saimadhav, can you quickly try Save As with x.py on Linux? |
I am using ActiveTcl8.5.15.1 and a latest Python for Macs taken from the python.org download page. I'm running OS X 10.9.5. |
Thanks, Raymond. Upon further investigation, I think you are running into a user-wide behavior of OS X rather than specifically a Tk or IDLE issue. By tradition and by default, OS X tries to hide file extensions in file Open or Save dialogs; this dates back to the days of Classic Mac OS when there was no concept of file extensions. There is a (non-obvious) user preference in the OS X Finder's preferences (Finder -> Preferences -> Advanced -> Show all filename extensions) that appears to control whether extensions are displayed by default in standard Open and Save dialogs in all applications, not just the Finder. (This is with OS X 10.9.x; I believe recent earlier systems behave similarly although the details might be slightly different). When the preference is unchecked (the default), then in "Save As" dialogs (in IDLE and other apps) a "Hide Extension" option box appears in the lower-left corner of the "Save As" popup window and, if enabled, the extension is not displayed as part of the file name. Unchecking the "Hide Extension" box causes the extension to appear. If the Finder "Show all filename extensions" advanced preference is checked, then the "Hide Extension" box does not appear on the "Save As" popup and the extension is always displayed. I always have the "Show all filename extensions" preference checked so I forgot it was there and its effect on all file dialogs. My guess is that you will want to have it enabled as well and then you should always see extensions. Note that for the initial "Save" of a file in IDLE (as opposed to a "Save As"), Python 3.4 supplies a default extension of ".py" which is displayed regardless of the Finder preference setting; but Python 2.7 up through the current 2.7.8 does not supply the default. That changes in 2.7.9 as Terry has recently backported the 3.x change to 2.7 (bpo-4832, although the commit message for the backport appears in bpo-3832 due to a typo). |
(I moved the commit message) I am assuming that Ned is correct. I think we should start documenting system peculiarities like this. I changed the title and will leave this open for this purpose. |
with files of type python: filename stored on disk -> x.py
with all files type : filename stored on disk -> x.py |
If Raymond concurs that either unchecking the Hide Extensions option or checking the Show All Filenmame Extensions preference solves the problem for him, we should just close this issue. In this particular case, the file is actually saved with a .py extension; it's just that the extension part is not displayed in the standard OS file dialogs. It is visible via, say, "ls" in a UNIX shell. This is standard OS X application behavior and caters to two different styles of file interaction. All OS X applications that use the standard file save dialogs work this way. See, for example, http://support.apple.com/kb/PH13920?viewlocale=en_US&locale=en_US. |
I should have mentioned before, but forgot, that Windows, by default, hides file name extensions in File Explorer. (The 'type' column supposedly makes them redundant.) If they are hidden, they are also hidden in the Save As name box, as described for MacOS. So I think this is worth a sentence in the doc. After 4 years, I want to close this with or without an edit (for this and/or bpo-4832). The current SaveAs entry is Save the current window with a Save As dialog. The file saved becomes the (Ned has previously said leave this alone for both issues.) Proposal: Save the contents of the current window with a Save As dialog. (If your file manager is set to hide extensions, the current extension will be omitted in the file name box.) If the new filename has no '.', '.py' and '.txt' will be added for Python and text files. (On MacOS Aqua, '.py' is added for any type.) The file saved becomes the new associated file for the window. Opinions? |
+1 for closing this either way, preferably with a note in the docs. I'd add the notes about extensions in one set of parenthesis at the end, but that's likely just a matter of taste. |
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name.
PR follows Tal's suggestion. |
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name.
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name. (cherry picked from commit 9890f86) Co-authored-by: Terry Jan Reedy <[email protected]>
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name. (cherry picked from commit 9890f86) Co-authored-by: Terry Jan Reedy <[email protected]>
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name. (cherry picked from commit 9890f86) Co-authored-by: Terry Jan Reedy <[email protected]>
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name. (cherry picked from commit 9890f86) Co-authored-by: Terry Jan Reedy <[email protected]>
File name extensions may or may not be shown for the current name and are added in an OS-dependent manner if not given for the new name.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: