Tk Source Code

View Ticket
Login
Ticket UUID: 108ada5dc8ea596781861aea97e712c702fe9041
Title: tk_getOpenFile is broken in macOS Monterey beta?
Type: Bug Version: Aqua 8.6.11
Submitter: davis Created on: 2021-09-01 03:22:02
Subsystem: (unused) Assigned To: marc_culler
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2021-11-09 22:16:19
Resolution: Fixed Closed By: marc_culler
    Closed on: 2021-11-09 22:16:19
Description:
I can't verify this myself, but a user reported that they are using my app on macOS Monterey beta (public beta 6, 21A5506j), and my file open command (called with: 
tk_getOpenFile -initialdir $default_dnadir -title "open DNA file" -parent $focus_win -multiple 1
)
returns a system error:
"The open file operation failed
The open file operation failed to connect to the open and save panel service"

I don't know if this is a bug in Monterey, or an incompatibility with tk introduced by the new OS. I thought I'd pass it along, in case.
User Comments: fvogel added on 2021-11-09 21:56:10:

Just a note to share that this fix and the release of 8.6.12 was useful:

https://sourceforge.net/p/scidvspc/mailman/message/37382065/


marc_culler (claiming to be Marc Culler) added on 2021-10-17 19:35:22:
This problem is now fixed with  check-in a32262e9.  Here is my synopsis
from the tkinter bug report:

Tk used to open the file dialog by calling [NSApp runModalForWindow:panel].
Starting with the release of 10.14 this call would produce a warning message
on stderr saying that [NSOpenPanel runModal] should be used instead.  But
on systems older than 10.14, the runModal method would fail because the
completion handler would not get called.  Now, with 12.0 (at least in the
beta) calling[NSOpenPanel runModal] produces an error dialog saying "The
open file operation failed to connect to the open and save panel service"
and this would be accompanied by a traceback printed on stderr for an
assertion error.  (It was not a "crash" but the file selection would
fail.)  However, it turns out that calling [NSApp runModalForWindow:panel]
no longer produces the warning in 12.0, and it works correctly.

The fix was to go back to using runModalForWindow in 12.0 and later.

marc_culler (claiming to be Marc Culler) added on 2021-09-06 12:35:10:
Thank you.  This has also been reported as a tkinter bug.  There does not
seem to be any documented change in the open and save panel API for
Monterey, so it may well be a Monterey bug which gets fixed before the
release.  I am keeping an eye on it.

There is one possibly related change in Monterey, which is that the 4-byte
OSType has been deprecated.  The open and save panel allowed using these
to specify which file types are accessible by the panel.