homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Automatic .py extension when saving with IDLE on OSX
Type: behavior Stage: resolved
Components: IDLE, macOS, Tkinter Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: IDLE does not supply a default ext of .py on Windows or OS X for new file saves
View: 4832
Assigned To: terry.reedy Nosy List: InfiniteHybrid, ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2016年09月06日 04:20 by InfiniteHybrid, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Messages (2)
msg274511 - (view) Author: Marcquise Washington (InfiniteHybrid) Date: 2016年09月06日 04:20
I am experiencing an issue where when I finish coding a program and I go to save file, just before running the program, I have manually add the .py extension, instead of the extension being already embedded with the file name, given that I am saving the file through the (IDLE/python) script/interpreter/compiler. On other systems it seems to automatically ad the .py extension when saving files, but not on my Macbook Pro (Running OS X El Capitan V 10.11.6). Please help
msg274535 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016年09月06日 07:36
This issue is essentially a duplicate of 4832,ドル in which Ned Deily added 'defaultextension' in the code below. Saving works fine on Windows, The added default extension is not shown in the input box of the SaveAs dialog but it is visible in file listing or in the IDLE editor title bar. Ned said that with the his addition, it also worked on OSX. Are you sure there is no extension in a file listing or title bar if you don't add .py? What tcl/tk version are you using? (See Help => About IDLE.)
The relevant code in idlelib/iomenu.py (IOBinding before 3.6),
 filetypes = [
 ("Python files", "*.py *.pyw", "TEXT"),
 ("Text files", "*.txt", "TEXT"),
 ("All files", "*"),
 ]
 defaultextension = '.py' if sys.platform == 'darwin' else ''
...
 def asksavefile(self):
 dir, base = self.defaultfilename("save")
 if not self.savedialog:
 self.savedialog = tkFileDialog.SaveAs(
 parent=self.text,
 filetypes=self.filetypes,
 defaultextension=self.defaultextension)
 filename = self.savedialog.show(initialdir=dir, initialfile=base)
 return filename
History
Date User Action Args
2022年04月11日 14:58:35adminsetgithub: 72152
2020年06月06日 16:01:46terry.reedysetstatus: open -> closed
superseder: IDLE does not supply a default ext of .py on Windows or OS X for new file saves
resolution: duplicate
stage: resolved
2016年09月06日 07:38:15terry.reedysettype: behavior
title: automatic .py extension -> Automatic .py extension when saving with IDLE on OSX
2016年09月06日 07:36:30terry.reedysetnosy: + serhiy.storchaka
messages: + msg274535
components: + Tkinter
2016年09月06日 04:44:32InfiniteHybridsettype: behavior -> (no value)
2016年09月06日 04:44:06martin.pantersetassignee: terry.reedy

type: performance -> behavior
components: + IDLE
nosy: + terry.reedy
2016年09月06日 04:20:06InfiniteHybridcreate

AltStyle によって変換されたページ (->オリジナル) /