Title: python crash using Tkinter
Type: crash Stage: resolved
Components: Tkinter Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: tkinter: "alloc: invalid block:" after askopenfilename
View: 22810
Assigned To: Nosy List: serhiy.storchaka, terry.reedy, tomnor
Priority: normal Keywords:

Created on 2015-06-28 22:01 by tomnor, last changed 2015-07-05 21:20 by tomnor. This issue is now closed.

Messages (6)
msg245917 - (view) Author: Tomas Nordin (tomnor) Date: 2015-06-28 22:01
$ python
Python 2.7.9 (default, Mar  1 2015, 18:22:53) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
The readline tab completion thing should be loaded. ( @home)
>>> import Tkinter as tk
>>> import tkFileDialog as tfd
>>> tk.Tk()
<Tkinter.Tk instance at 0xb72206ec>
>>> tk.Tk()
<Tkinter.Tk instance at 0xb7117a8c>
>>> tfd.askopenfilename()
>>> # closing the root window
>>> alloc: invalid block: 0x99ddcd8: 88 9

$ uname -a
Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.68-1+deb7u1 i686 GNU/Linux

See also #22810
msg246200 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-07-03 17:56
This should be closed as duplicate of #22810.  Tracker malfunctioning right now.
msg246202 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-07-03 17:59
Will not accept superseder
msg246203 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-07-03 18:02
On Windows 7, no problem on either 2.7.10 or 3.5.0b2 (running from Command Prompt so would see message is there were one).
msg246311 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-07-05 12:36
Unfortunately can't reproduce the issue in 2.7.6, 2.7.10+, 3.4.0, 3.4.3+, 3.5.0b2+, 3.6.0a0 with Tcl/Tk 8.6.1.

The only output is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/", line 125, in askopenfilename
    return Open(**options).show()
  File "/usr/lib/python2.7/lib-tk/", line 48, in show
    s =, *w._options(self.options))
_tkinter.TclError: can't invoke "grab" command: application has been destroyed
msg246340 - (view) Author: Tomas Nordin (tomnor) Date: 2015-07-05 21:20
I have not experienced this problem on windoze. The problem seem to have appeared when upgrading my operating system from Debian wheezy to jessie, I think with python going from 2.7.3 to 2.7.9. And I have a stomach feeling it is related to the environment. I have filed a bug report at debian too, or I am working on it.

With the initial description I have been wanting to say that just opening the root window and closing it does not crash python. But open it, use askopenfilename and then close the root window lead to a crash.
Date User Action Args
2015-07-05 21:20:08tomnorsetmessages: + msg246340
2015-07-05 12:36:42serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg246311
2015-07-03 18:14:27zach.waresetsuperseder: tkinter: "alloc: invalid block:" after askopenfilename
2015-07-03 18:02:52terry.reedysetmessages: + msg246203
2015-07-03 17:59:39terry.reedysetmessages: + msg246202
2015-07-03 17:56:56terry.reedysetstatus: open -> closed
resolution: duplicate
stage: resolved
2015-07-03 17:56:31terry.reedysetnosy: + terry.reedy
messages: + msg246200
2015-06-28 22:01:27tomnorcreate