IDLE3 crash despite tkinter “correct” version


(Cazza) #1

On macOS High Sierra 10.13.6, I have used Python3.7.1, installed directly from python.org, with biopython and used IDLE successfully, and happily, for some time.

Wanting to add a GUI, I used Homebrew to add PyGobject. This installs its own Python, and went to 3.7.2. The IDLE running from the HomeBrew install warns that I am using an unstable TCL/tk, despite this page saying Python3.7.x has an internal version of Tcl/tk to avoid this long-standing issue.

> Python 3.7.2 (default, Dec 27 2018, 07:35:52) [Clang 10.0.0 (clang-1000.11.45.5)] on darwin Type “help”, “copyright”, “credits” or “license()” for more information. WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.

It duly crashes when editing a file.

> Traceback (most recent call last): File “/usr/local/bin/idle3”, line 5, in main() File “/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/pyshell.py”, line 1569, in main root.mainloop() File “/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/ init .py”, line 1283, in mainloop self.tk.mainloop(n) UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte

Why is the Homebrew version behaving differently?


(Sean Molenaar) #2

Because it doesn’t have a version of tcl/tk


(Cazza) #3

I had already installed tck/tk using Homebrew and tested it was the correct version.

brew install tcl-tk

I did get

tcl-tk is keg-only, which means it was not symlinked into /usr/local,

because tk installs some X11 headers and macOS provides an (older) Tcl/Tk.

If you need to have tcl-tk first in your PATH run:

echo ‘export PATH="/usr/local/opt/tcl-tk/bin:$PATH"’ >> ~/.bash_profile

So I duly added to PATH

ARWallace:~ $ echo $PATH

/usr/local/opt/tcl-tk/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

& tested tck/tk version

ARWallace:~ $ tclsh

% info patchlevel

8.6.8


(Sean Molenaar) #4

Yeah, homebrew’s python doesn’t include tcl-tk. You might have an install but homebrew’s python doesn’t use it.


(Cazza) #5

Thanks for a definitive answer, but puzzling given that it’s the same version of Python as native and documented here as saying that those later versions of Python have "A built-in version of Tcl/Tk 8.6 ". Why would Homebrew’s be different?