[issue21603] IDLE SaveAs drops the extension in the prompted filename

Ned Deily report at bugs.python.org
Sun Oct 12 11:06:14 CEST 2014


Ned Deily added the comment:

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 (Issue4832, although the commit message for the backport appears in Issue3832 due to a typo).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21603>
_______________________________________


More information about the Python-bugs-list mailing list