Skip to content

Automatic .py extension when saving with IDLE on OSX #72152

Closed

Description

@InfiniteHybrid
BPO 27965
Nosy @terryjreedy, @ronaldoussoren, @ned-deily, @serhiy-storchaka
Superseder
  • bpo-4832: IDLE does not supply a default ext of .py on Windows or OS X for new file saves
  • 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:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2020-06-06.16:01:46.028>
    created_at = <Date 2016-09-06.04:20:06.208>
    labels = ['OS-mac', 'expert-IDLE', 'type-bug', 'expert-tkinter']
    title = 'Automatic .py extension when saving with IDLE on OSX'
    updated_at = <Date 2020-06-06.16:01:46.028>
    user = 'https://bugs.python.org/InfiniteHybrid'

    bugs.python.org fields:

    activity = <Date 2020-06-06.16:01:46.028>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-06-06.16:01:46.028>
    closer = 'terry.reedy'
    components = ['IDLE', 'macOS', 'Tkinter']
    creation = <Date 2016-09-06.04:20:06.208>
    creator = 'InfiniteHybrid'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 27965
    keywords = []
    message_count = 2.0
    messages = ['274511', '274535']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'ronaldoussoren', 'ned.deily', 'serhiy.storchaka', 'InfiniteHybrid']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '4832'
    type = 'behavior'
    url = 'https://bugs.python.org/issue27965'
    versions = ['Python 3.5']

    Activity

    1. InfiniteHybrid commented on Sep 6, 2016

      InfiniteHybridmannequin
      MannequinAuthor

      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

    2. added
      type-bugAn unexpected behavior, bug, or error
      and removed
      performancePerformance or resource usage
      on Sep 6, 2016
    3. terryjreedy commented on Sep 6, 2016

      @terryjreedy
      Member

      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

    4. changed the title [-]automatic .py extension[/-] [+]Automatic .py extension when saving with IDLE on OSX[/+] on Sep 6, 2016
    5. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions