Tk Source Code

View Ticket
Login
Ticket UUID: dcb35fbd78a0bc31ad409cf717f16a472ca3f627
Title: Crashes caused by msgcat namespace error
Type: Patch Version: 8.6.8
Submitter: Adam Created on: 2020-07-17 17:38:32
Subsystem: 33. Generic Dialog Support Assigned To: marc_culler
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2020-07-25 15:01:18
Resolution: Accepted Closed By: marc_culler
    Closed on: 2020-07-25 15:01:18
Description:

We have an application written in Python that uses Tk as its interface. When running on macOS Big Sur, the window of the application is transparent. There are no errors logged and the applications runs fine otherwise (as long as no user input is required).

Example of what it looks like:


Tech stack & version numbers:
Tcl/Tk 8.6.8
embedded into Python 3.7.6
frozen into a stand-alone executable using PyInstaller 3.6

We tried Tcl/Tk version 8.5.9 with the same Python and PyInstaller version, but it was crashing:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x00007fff05058e58 ???
1 libsystem_kernel.dylib 0x00007fff716f8842 __pthread_kill + 10
2 libsystem_c.dylib 0x00007fff7166b4f0 abort + 120
3 Tcl 0x00007fff392d4925 Tcl_PanicVA + 398
4 Tcl 0x00007fff392d49a5 Tcl_Panic + 128
5 Tk 0x00007fff393d4ad0 TkpInit + 364
6 Tk 0x00007fff39354798 0x7fff39323000 + 202648
7 _tkinter.so 0x000000011004ab9d Tcl_AppInit + 82

User Comments: marc_culler (claiming to be Marc Culler) added on 2020-07-25 15:01:18:
Thank you, Adam!  Well done!

It was a long road from transparent windows to msgcat, but the end result
should fix a very annoying problem.

I didn't realize that the fix was that simple, or that the problem was that
famous. :^)

Adam added on 2020-07-24 19:13:47:
The attached patch fixes macOS apps built using PyInstaller closing immedetialy after being opened.

The error logged without the patch is the folllowing:
_tkinter.TclError: invalid command name "msgcat::mc"

The issue is well described here:
https://github.com/pyinstaller/pyinstaller/issues/3820
https://stackoverflow.com/questions/56092383/how-to-fix-msgcatmc-error-after-running-app-from-pyinstaller-on-macos-mojave

marc_culler (claiming to be Marc Culler) added on 2020-07-24 16:31:57:
Reopening this ticket, waiting for a patch from @Adam,

marc_culler (claiming to be Marc Culler) added on 2020-07-19 18:43:09:
Closing the ticket after providing Adam with a script that updates the
embedded Tk in a python.org framework.

Adam added on 2020-07-17 18:08:06:
I'd love to get some instructions how to update the embedded Tk. The latest  version of Python supported by PyInstaller is 3.7.6 and it already took multiple hacks to get it to work with the Tkinter 8.6.8 that ships with Python when downloaded from www.python.org.

marc_culler (claiming to be Marc Culler) added on 2020-07-17 17:53:09:
You should begin by upgrading to Python 3.8, which embeds a much less buggy
version of Tk.

I am able to run both Tk and tkinter apps on Big Sur without any of these
issues.

It is not difficult to replace the embedded Tk in a Python installation, and I
can show you how to do that if necessary.  But I doubt it will be necessary.

Attachments: