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.

Title: Python 3.8.2 Mac freezing/not responding when saving new programs
Type: crash Stage:
Components: IDLE Versions: Python 3.9, Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Zain, aboeckmann, franksj, ned.deily, rhettinger, terry.reedy
Priority: high Keywords:

Created on 2020-05-07 20:55 by Zain, last changed 2022-04-11 14:59 by admin.

File name Uploaded Description Edit
Screen Shot 2020-05-07 at 3.46.02 PM.png Zain, 2020-05-07 23:26
Messages (23)
msg368375 - (view) Author: Zain Said (Zain) Date: 2020-05-07 20:55
What I'm currently using: 
Mid 2012 13'' MacBook Pro OS Catalina 10.15.4
Python 3.8.2

I'm having an issue with saving a new python program. When I go to "save as" a program python seems to freeze/not . The only way I've been able to get python working again is to "Force Quit" the existing process and reopen IDLE. Running and writing existing programs seems to be working fine.
msg368380 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-05-07 21:26
I frequently have this issue as well.  My workaround is awful:  I go to the terminal prompt to create an empty file with the desired name, and then open it up in IDLE to edit and save.  This avoids the SaveAs dialog window that triggers the failure.

This doesn't happen to me with new, empty directories.  So, my best guess is that the document preview in the SaveAs window is triggering the failure.  

This problem may go away in the future with a O/S update or with a Tcl/Tk update. AFAICT, IDLE doesn't have any way to ask for a simplified FileDialog window.
msg368381 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-05-07 21:32
Perhaps we could create an option in the general settings that offers a workaround:  open a regular text window to get the filename.  

This wouldn't be as pretty (won't display filenames, offer mouse support, won't show file previews), but it would be reliable.
msg368385 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-05-07 22:25
Zain and/or Raymond: can you please give the exact steps to reproduce this problem, including exactly how you invoke IDLE, the Python version info and build date info from the IDLE shell window, the details of exactly how you invoke Save As (i.e whether via clicking on the menu bar File menu or instead by using a keyboard shortcut like shift-cmd-S. And when the SaveAs window appears perhaps a screen shot or at least what options you have selected (icons, list, etc, expanded or compressed window) and what is the default folder it opens to. I am not able to reproduce a hang although I do see some delays. Also what happens if you just use Save for a new file rather than Save As? If it's a new file, that should also produce a Save file window and that's what I always use when smoke testing.  EIther should work, of course :(
msg368386 - (view) Author: Zain Said (Zain) Date: 2020-05-07 23:26
Sure i'll supply a screenshot 
This problem doesn't effect saving in general after editing existing programs by the way.
My process of saving a program:
  - I'll open IDLE (Python 3.8.2)
  - write anything at all
  - I'll either hit command>s or click file>save as then ill be prompted to name my program and then save as (also if i want to rename an existing program the same issue occurs)
  - after typing in the name of the new program ill click save as then most of the window goes blank (you'll see in the screenshot)
msg368387 - (view) Author: Zain Said (Zain) Date: 2020-05-07 23:27
The screenshot link is at the top of the thread
msg368418 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-08 05:07
Zain, what I understand is:
> python3.8 -m idlelib # To open idle from Terminal
In IDLE, File=>New, then File=>SaveAs
In dialog opened to Documents, enter name in Save As box, then click Save.

For me 2012? Macbook Air with 10.14.6? Mohave and 3.8.3rc1, dialog disappears and the (blank) file is saved, with a confirmation dialog if name exits.

For you, the Documents name list disappears and maybe something else (or vice versa) and the dialog freezes.  I presume keys and clicks have no effect.  The freezing itself is almost certainly an issue between macOS and tcl/tk 8.6.8.  If you start IDLE in Terminal, does anything error message appear?

The relevant IDLE code is idlelib.iomenu.IOBInding.asksavefile, which creates an instance of tkinter.filedialog.SaveAs and calls its show method, inherited from tkinter.commondialog.CommonDialog.  The important line there is 's =, <options>)', where the save as command is 'tk_getSaveFile'.  This tk command is documented in  
There are Mac-specific items but nothing jumped out at me as significant for this issue.

To debug, and test Raymond's hypothesis, someone please try this minimal (IDLE-free) code to show the dialog and print the return.  (Interactive should work, at least on IDLE.)

import tkinter as tk
r = tk.Tk()

This does not display a preview, even after selecting a location, such as Documents, on the 3rd line.  If that works, try deleting the 'dir' option in the .show call.  Other options in the SaveAs and show calls could be experimentally deleted if needed.  If something works, we could use platform.mac_ver()[0].split('.')[1] to detect Catalina and switch to the workaround.
msg368475 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2020-05-08 22:00
Zain, do you happen to be working in a Dropbox synced directory when you observe the failure?
msg368483 - (view) Author: Zain Said (Zain) Date: 2020-05-08 23:09
I posted my issue on Experts Exchange and they suggested to go to system preferences>Security&Privacy>go to privacy tab on the top>scroll down to Full Disk Access>Add IDLE and Python>then check off the box next to it> 

Since then my issue with IDLE not being able to save (save as) new programs has gone away. 

Maybe try this and let me know if this solves you're issue. 

Also I'm fairly new to python and coding in general and i rarely use terminal.
msg368485 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-05-08 23:29
That enabling FullDiskAccess makes a difference makes some sense but that is not something we should be recommending without better understanding what's going on here. We still need a reproducible test case; I still am not able to reproduce. Raymond, your hint about Dropbox is promising; can you say more, i.e. do you see hangs if you the folder you are saving to is within your Dropbox folder hierarchy? Zain, do you use Dropbox?  And do either of you have your Documents folder stored in iCloud:

System Preferences -> Apple ID (top right) -> iCloud -> iCloud Drive (Options) -> Documents -> Desktop & Documents Folders (checked)
msg368488 - (view) Author: Zain Said (Zain) Date: 2020-05-08 23:41
Ned, I do not use DropBox nor do i have Desktop & Documents Folders checked under my iCloud settings. 

Someone else in the community reached out to me and suggested that if IDLE is acting up its not worth the hassle. And that they're alternatives. I came a across an editor called Atom. Seems interesting. Might give it a try.
msg368489 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-08 23:47
When I click Full Disk Access in Mohave, I see an empty box with a Header something like "All app to access Mail, ..., and all user data".  None of it has anything obviously to do with the user Documents folder.  Nor does it seem appropriate for a non-top-admin user on a multiuser machine.  Below the box are [+][-] buttons.  [+] opens the standard open dialog to select an app to add.  There is nothing like 
  [ ] Add Python and IDLE

Ned, is Catalina known to have tightened up some security settings?
msg368493 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-09 00:57
What is acting up here is the Catalina system SaveAs dialog on some systems with some settings when closing after being asked to display the current contents of the target location, allow the content to be variously filtered or not, and add a default extension.  (I use all of these features.)  I looked at 3 Apple apps, Safari, Maps, and they omit the content display, and hence filtering. It it is only the display that is bugged, they would not show the  problem.
msg368568 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-10 05:45
I asked about other people's experiences on python-list and got 2 responses so far.

On macOS The default Save/Save as dialogs are short, only displaying a few major folders along with Favorites and Recents.  That dialog doesn’t display folder contents.  However, you can get an expanded dialog by clicking on the little arrow to the right of the Where box.  Using that dialog allows one to select any folder and displays folder contents.  

I tried using both Save and Save as, and was unable to duplicate the problem with either the short or the long dialog.

Python 3.8.2
macOS Catalina 10.15.4
Bev in TX

Fairly recently, Tk has got many bugfixes because of changes in OSX. Here is the file that implements the file dialogs:
and the history:

As you can see, it has been touched two days ago (!) to restore some window behaviour, which was switched of because of Catalina last August (this commit)

Christian Gollwitzer

Ned, what is your latest experience with 8.6.10?
msg368648 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-11 20:54
Mat Wichmann responded
"we had three of these in the last few weeks sent to  I just went back and pinged those folks with a
request to look in on the issue, and contribute to it if they had
anything new/useful to add."
msg368650 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-11 21:00
Raymond, can you run the tests I suggested above?
msg368662 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-05-11 21:53
>To debug, and test Raymond's hypothesis, someone please try this minimal (IDLE-free) code to show the dialog and print the return.  
>This does not display a preview, even after selecting a location, such as Documents, on the 3rd line.

Terry, I'm not sure I know what you mean here by preview. Do you mean the Column view of the Save sheet?  As "Bev in TX" explained in the quote you supplied earlier, the standard macOS Save or Save As save sheet which nearly all macOS apps use including Tk in IDLE has several settings, settings that are usually remembered across application invocations. By default initially, a compact display is given with boxes for Save As, Tags, and a pull-down Where list of folders.  To its right, there should be an button with a "V" icon.  When pressed, the "V" changes to a "^" and the Save sheet expands to show more stuff.  What stuff it shows depends on the setting of the view options which can be accessed by clicking on the button with an array of six little squares on it, usually towards the upper left side of the Save sheet.  In it are the three main Show Items as options: "Icons", "List", "Columns". There are other options in there, too. So when discussing the appearance of macOS Open or Save dialog sheets, one has to be really precise about what options are in effect for that particular Save. Those are under the control of the user and, again, are remembered by the operating system. Note also that for Save using he column view, the system does not show previews of existing files; it does for Open files, which you should be able to see if you substitute tk_getOpenFile in your test code.

In any case, I ran your test on both 10.15 and 10.14 and so far have still seen no problems, no hanging. I don't doubt these reports that people are seeing hangs but we still need to be able to reproduce them.  

FWIW, for every macOS Python installer before it is permitted to be released, I run a smoke test that, among other things, does essentially does what is reported here: launch, open a new file window, add a few lines including a print function, preess F5 to Run bringing up the Save dialog, Save the file, and verify that the expected output shows up in the IDLE shell window. Each installer is tested on at least one macOS system level, always the latest release and usually at least one older release. In years of doing this, I've never seen a hang like those being reported. So that's why I'm particularly curious about this because there is a lot of baseline experience over many releases of macOS, Python, and Tk for that matter. We'll keep searching.  But it would still be *really* helpful if, as I requested before, someone who does see these hangs and can reliably reproduce them, documents *exactly* all the steps to do so, from exactly how IDLE is launches to exactly how the Save dialog is invoked (by menu bar or keyboard shortcut or ...) and what options of the Save dialog are in effect.
msg368698 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-12 02:37
By 'preview', I meant the listing of existing file in the directory, such as Documents.  IDLE displays this but, as I inferred and you and Bev confirmed, this is not standard on macOS, as there is a button (which I did not noticed before) to show or hide the file list and other stuff. (There is no such button on Windows.) So *if* it is the problem culprit for some people, we could, I presume, leave the pane initially hidden.

Is the filelist pane a 'sheet'?  Could the recent 'sheets' fix (Christian's comment) for these dialogs on Catalina be involved?  What is your latest take on 8.6.10 for OSX?
msg375130 - (view) Author: James Franks (franksj) Date: 2020-08-10 17:01
Hope this helps:

I'm running Python Shell 3.8.5 on MacOSx 10.15.6 (Catalina).  I can reproduce this hang easily.

Open any existing module or create a new one.  Can save the existing module or a new one just fine under the same name. (File menu - Save)

Using "Save as..." from File dropdown menu, Windows appears, change the name, hit Save button and IDLE hangs.

After approximately a minute the window becomes active again, but when hitting any button (Cancel or Save) it hangs again.  No way to get out of this but force quit IDLE.

My files are in iCloud documents folder.

Did the same test with a Mac running Mojave (10.14.6) Also with Python Shell 3.8.5.  Works fine.  Seems to be something with Catalina as some have mentioned. 

Please help.  This is extremely frustrating for someone like me just trying to learn Python.  I will switch over to the machine running Mojave.  Thanks for helping!
msg375395 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-08-14 11:21
James, thanks very much for your detailed instructions. Alas, once again, I am unable to reproduce the hanging behavior under apparently similar conditions (10.5.6, Documents folder on iCloud, etc). I know this is frustrating to all of us. I have one new concrete suggestion: if someone who can reproduce this behavior at will is willing to allow me to screen share into their system (via Apple's Messages app) so they can demonstrate it live, perhaps that will allow us to better isolate the problem.  If anyone is interested in helping with this, contact me via email (nad at python dot org) and we can set up a time.
msg375654 - (view) Author: Alexander Boeckmann (aboeckmann) Date: 2020-08-19 15:45
Hey! I have the exact same thing as described happening! Python freezes when I try to save new files which sucks. 
I'm on Catalina: 10.15.6
IDLE: 3.8.5
Brand new MacBook Air
As said earlier the only way out is to force quit. Would taking a video help?
I'll make one anyways
msg375714 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-08-20 15:20
> Would taking a video help?

It couldn't hurt and might very well help.

> I'll make one anyways

Thank you!
msg376012 - (view) Author: Alexander Boeckmann (aboeckmann) Date: 2020-08-27 18:58
So over the past week the issue resolved its self. I unfortunately did not get a video or a screenshot but thought you might want to know this
So maybe Apple did something or you guys fixed it. Anyways, have a good day!
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84733
2020-08-27 18:58:48aboeckmannsetmessages: + msg376012
2020-08-20 15:20:13ned.deilysetmessages: + msg375714
2020-08-19 15:45:30aboeckmannsetnosy: + aboeckmann
messages: + msg375654
2020-08-14 11:21:27ned.deilysetmessages: + msg375395
2020-08-10 17:01:19franksjsetnosy: + franksj
messages: + msg375130
2020-05-12 02:37:54terry.reedysetmessages: + msg368698
2020-05-11 21:53:09ned.deilysetmessages: + msg368662
2020-05-11 21:00:55terry.reedysetmessages: + msg368650
2020-05-11 20:54:17terry.reedysetmessages: + msg368648
2020-05-10 05:45:23terry.reedysetmessages: + msg368568
2020-05-09 00:57:32terry.reedysetmessages: + msg368493
2020-05-08 23:47:53terry.reedysetmessages: + msg368489
2020-05-08 23:41:59Zainsetmessages: + msg368488
2020-05-08 23:29:07ned.deilysetmessages: + msg368485
2020-05-08 23:09:54Zainsetmessages: + msg368483
2020-05-08 22:00:01rhettingersetmessages: + msg368475
2020-05-08 05:07:03terry.reedysetmessages: + msg368418
versions: + Python 3.9
2020-05-07 23:27:35Zainsetmessages: + msg368387
2020-05-07 23:26:25Zainsetfiles: + Screen Shot 2020-05-07 at 3.46.02 PM.png

messages: + msg368386
2020-05-07 22:25:55ned.deilysetnosy: + ned.deily
messages: + msg368385
2020-05-07 21:32:18rhettingersetmessages: + msg368381
2020-05-07 21:26:46rhettingersetpriority: normal -> high

nosy: + terry.reedy, rhettinger
messages: + msg368380

assignee: terry.reedy
components: + IDLE
2020-05-07 20:55:32Zaincreate