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: Tkinter File Dialog crashes on Win7 when saving to Documents Library
Type: crash Stage: resolved
Components: Tkinter, Windows Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Brian.Gernhardt, Cody.C, alirahmjoo, amaury.forgeotdarc, gpolo, roger.serwy, terry.reedy
Priority: high Keywords:

Created on 2011-09-15 21:45 by Brian.Gernhardt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)
msg144106 - (view) Author: Brian Gernhardt (Brian.Gernhardt) Date: 2011-09-15 21:45
Python 3.2.1 (default, Jul 10 2011, 20:02:51) [MSC v.1500 64 bit (AMD64)] on win32

1) Start IDLE
2) Open Save dialog (File > Save or Ctrl-S)
3) Select Libraries from the buttons on the left or the dropdown on top.
4) Double-click on Documents
5) Enter any file name (test.txt)
6) Hit enter or click save
7) See "pythonw.exe has stopped working dialog"

I tried running it from the command line (via c:\python32\python -m idlelib.idle) and it produced no useful error messages.
msg144157 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-09-16 20:42
I got same with 3.2.2. I did it first from editor window and it only crashed that window, leaving the shell window ok until I tried it there also.
msg144160 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-09-16 20:54
The view of MyDocuments in the save dialog is different from that of Windows Explorer. In particular, it shows a directory twice, the current version and an older version. Double clicking the current version, to see the contents, also crashed IDLE without saving. Win Explorer moves into that directory just fine.

Tried it again, and double click into dirs now works. Saving still crashes. But I still see two versions of the directory when accessing from IDLE (until I redeleted the older one). Saving still crashes.
msg147452 - (view) Author: Cody C (Cody.C) Date: 2011-11-11 23:22
Still an issue as of 11/11/11.
msg161168 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-05-19 22:14
On Win7, I can replicate the problem with 64-bit Python 3.2.3. However, it does not occur for 32-bit Python 3.2.2.

This problem is not due to IDLE. There is a problem with the 64-bit version of tkinter's file dialog. From a 64-bit python environment, bring up the dialog with:

    import tkinter.filedialog

and repeat the steps 3-6 from msg144106. It crashes. Repeating this with a 32-bit python environment does not have a problem.
msg161170 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-05-19 23:40
I re-verified this on win7-64 with 3.3.0a3
From Idle, Idle remains after clicking away the error box.
From Command Prompt, CP disappears after clicking away box.

Problem is not specific to Donwloads. Other Libraries fail also.
Desktop and other normal places succeed.

I cannot but wonder if this is a tk bug.
msg162448 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-06-07 02:04
I closed #14996 as a duplicate of this. The OP there claimed that behavior changed between 3.2.1 and 3.2.3 and that she had same problem with 32 bit installation. It is hard to know the exact circumstances of the problem until we find its cause.

Looking further, I am sure this is a tk and/or Win7 problem.
tkinter.filedialog.asksaveasfile() calls SaveAs(**options).show()
SaveAs sets command = "tk_getSaveFile" and inherits _Dialog which inherits commondialog.Dialog. The show method of that calls, *w._options(self.options)). Since the test call has no options, self.options is an empty dict and I presume the serialized form w._options() is also. So the call amounts to"tk_getSaveFile"), which suspends python until the dialog returns.

That said, 3.3.0a4 was released a week ago with tcl/tk upgraded, in the Windows installer, from 8.5.9 to 8.5.11. So I retried the previous test and the problem is gone. Can someone else verify? If so, we can close this as fixed. (I believe that the same upgrade will appear in future 3.2 and 2.7 releases, but I am not sure.)
msg162449 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-06-07 02:32
I installed 3.3.0a4 (64-bit) on Win 7 and the issue did not occur when using asksaveasfile. I repeated with 32-bit 3.3.0a4 without any problems.

How can we confirm that 3.2 will receive the Tcl/Tk upgrade? (64-bit 2.7.3 does not have this bug.)
msg162450 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-06-07 02:32
msg165048 - (view) Author: Ali Rahmjoo (alirahmjoo) Date: 2012-07-08 23:58
I have exactly the same problem mentioned by Brian Gernhardt for 32-bit Python 3.2.3 on Win7.
msg183765 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-08 20:47
As near as I can tell, the tcl/tk distributed with Windows is not upgraded in bugfix releases. I presume it is a matter of testing and stability and not introducing any new features in the new tcl/tk. In any case, on Windows, this is fixed in 3.3 (and hopefully in 3.4) but will apparently not be fixed in earlier microreleases. That sometimes happens.
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57197
2013-03-08 20:47:55terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg183765

stage: resolved
2012-07-08 23:58:49alirahmjoosetnosy: + alirahmjoo
messages: + msg165048
2012-06-07 02:32:41roger.serwysetstatus: closed -> open
resolution: out of date -> (no value)
messages: + msg162450
2012-06-07 02:32:18roger.serwysetstatus: open -> closed
resolution: out of date
messages: + msg162449

versions: - Python 3.3
2012-06-07 02:04:17terry.reedysetmessages: + msg162448
2012-06-07 01:21:56terry.reedylinkissue14996 superseder
2012-05-19 23:40:43terry.reedysetnosy: + gpolo
messages: + msg161170
2012-05-19 22:14:09roger.serwysetpriority: normal -> high
versions: + Python 3.3
title: IDLE on Win7 crashes when saving to Documents Library -> Tkinter File Dialog crashes on Win7 when saving to Documents Library
messages: + msg161168

components: + Tkinter, Windows, - IDLE
2011-11-15 23:23:39roger.serwysetnosy: + roger.serwy
2011-11-12 00:31:15ned.deilysetnosy: + amaury.forgeotdarc
2011-11-11 23:22:49Cody.Csetnosy: + Cody.C
messages: + msg147452
2011-11-11 23:21:52Cody.Csettype: crash
2011-09-16 20:54:45terry.reedysetmessages: + msg144160
2011-09-16 20:42:28terry.reedysetnosy: + terry.reedy
messages: + msg144157
2011-09-15 21:45:05Brian.Gernhardtcreate