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: IDLE crashes when opening .py file from Finder
Type: crash Stage: resolved
Components: IDLE, Installation, macOS, Tkinter Versions: Python 2.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, ronaldoussoren, terry.reedy, wkdewey
Priority: normal Keywords:

Created on 2016-12-10 00:39 by wkdewey, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
error.txt wkdewey, 2016-12-10 00:39 Crash report
Messages (4)
msg282815 - (view) Author: (wkdewey) Date: 2016-12-10 00:39
Every time I try to open a .py file from the Finder (macOS Sierra), IDLE opens up and then immediately "unexpectedly quits." I can open them from within IDLE without the same problem

I've attached Apple's crash report. Additionally, in the Console I get an error message like "IDLE[14872]: objc[14872]: Invalid or prematurely-freed autorelease pool 0x7f81bf959048." every time the crash happens 

I am using Python 2.7.12; I installed the correct version of tcltk (something that is frequently mentioned when I search online for this problem) so that isn't the issue.
msg282820 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-10 02:30
From the crash report, it appears you are using a Python 2.7.12 and Tcl/Tk 8.6 installed from Homebrew.  The crash appears to be happening as a result of the Open Apple Event from the Finder to Tk.  At first glance, I'm not able to reproduce the crash using a python.org 2.7.12 with an ActiveState Tcl/Tk 8.5.18 also on macOS 10.12.1. I don't have a Homebrew installation handy to test with and I don't really have time right now to dig into it but I think it very unlikely to be an issue with Python itself.  You might want to open a Homebrew issue and/or a Tk issue.
msg282883 - (view) Author: (wkdewey) Date: 2016-12-10 22:23
The ultimate solution was to uninstall homebrew, since there is no obvious way to get it to use the right version of Tcl/Tk (8.5.18). And then to install the python binary from python.org, which does pick up the right version of Tcl/Tk. 

I can't remember why I was using homebrew, but the instructions at https://www.python.org/download/mac/tcltk/ (where you get pointed from IDLE) were a little unclear. I didn't realize that "if you are using OS X 10.9 or later and a Python from a python.org 64-bit/32-bit installer" didn't refer to the Python that came with macOS, or that I had to (or even could) install the python.org binary on top of the Python that was already there.
msg282885 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-10 23:10
I'm glad you got it working.  The information at https://www.python.org/download/mac/tcltk/ pertains primarily to using Pythons from the python.org installers; it doesn't directly apply to Python instances built by and supplied by third-party distributors like Homebrew or MacPorts.  So there is nothing wrong about them supplying and linking their Pythons with their own version of Tcl/Tk, be it 8.6.x or 8.5.x.  It would be good to figure out what the problem was that you saw and whether it is a general problem for other Homebrew users but that is out of scope for this tracker.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73114
2016-12-10 23:10:06ned.deilysetstatus: open -> closed

messages: + msg282885
stage: resolved
2016-12-10 22:23:25wkdeweysetstatus: pending -> open

messages: + msg282883
2016-12-10 05:33:26terry.reedysetstatus: open -> pending
2016-12-10 05:33:15terry.reedysetstatus: pending -> open
assignee: terry.reedy ->

components: + Installation, macOS, Tkinter
nosy: + ronaldoussoren
2016-12-10 02:31:00ned.deilysetstatus: open -> pending

nosy: + ned.deily
messages: + msg282820

resolution: third party
2016-12-10 00:39:26wkdeweycreate