TransWikia.com

Why does launching IDLE from a second terminal window eventually lead to it freezing both? What's a good work-around or fix?

Super User Asked on November 26, 2020

I have a new macOS laptop with recent Anaconda Python 3.7 installation. I use iTerm2 to open two bash command windows; from the first one I run Python and in the second one I just type "idle" which the Anaconda installation set as a command to start its version of IDLE IDE. Yes, it’s for beginners but I just like it.

After a while of running scripts which open plots, the first window where I’m working freezes and I can no longer type. This usually happens after I have plotted something with matplotlib.

The recovery is to close iTerm and Idle and start all over again.

Since this involves some combination of OS and bash and Python I’m not sure where to ask this question, so I thought I would try here first.

Question: Why does launching IDLE from a second terminal window eventually lead to it freezing both? What’s a good workaround or fix?


Update: There are warnings in the second iTerm2 window when I start IDLE, this may be the source of the problem:

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
2020-08-03 17:08:26.299 Python[561:6540] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.300 Python[561:6540] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2020-08-03 17:08:26.385 Python[561:6540] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.411 Python[561:6540] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-08-03 17:08:26.411 Python[561:6540] CoreText note: Client requested name ".sf ns mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].

One Answer

The Apple-supplied tcl/tk 8.5.9 is about a decade old and is known to be buggy and prone to crashes. (Clearly, Apple does not want one to use it, or it would update it.) Hence Python programs like IDLE that use tk 8.5.9 via tkinter and use a variety of its features are prone to crashing -- unpredictably.

Until a couple of years ago, python.org had a page for Mac tkinter users explaining how to download and install a more recent tcl/tk from ActiveState. The current python.org installers for 2.7.16, 3.7, 3.8, and 3.9 install tcl/tk 3.6.8, which runs much better. (But Catalina changed graphics enough to introduce some new incompatibilities.)

Python core developers have no responsibility for Anaconda and how it compiles _tkinter.c (whether to run with tcl/tk 8.5 or 8.6) and whether it installs a usable tcl/tk as part of the distribution.

Answered by Terry Jan Reedy on November 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP