NSApplicationDelegate.applicationSupportsSecureRestorableState: Error

WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

Since I upgraded to Sonoma !4.0, VsCode tkinter application stopped and everything is blocked

unable to program further anything with chatgpt

Posted on Oct 1, 2023 1:18 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 24, 2023 9:23 AM

You will get that warning even when referencing Tk/Tcl 8.6.12 in Python3 v3.12. If this is a command-line application, simply redirect its stderr to /dev/null (e.g. 2> /dev/null).


#!/usr/bin/env python3

import os
import sys

try:
    import Tkinter as tk      # Python 2
except ImportError:
    import tkinter as tk      # Python 3
	
def main():
	
    # same as 2> /dev/null in the shell
	f = open("/dev/null", "w")
	os.dup2(f.fileno(), 2)
	f.close()

	print("Tcl Version: {}".format(tk.Tcl().eval('info patchlevel')))
	print("Tk Version: {}".format(tk.Tk().eval('info patchlevel')))

	
if __name__ == '__main__':
	sys.exit(main())

Without those first three lines under main(), I get this output when run from the command-line in macOS Sonoma 14.1.1:

Tcl Version: 8.6.12
2023-11-24 12:09:24.253 Python[4114:134228] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Tk Version: 8.6.12


and after redirecting stderr (2):

Tcl Version: 8.6.12
Tk Version: 8.6.12


This is not specifically a Tk/Tcl issue as I have Python3 apps using PySide Qt 6.5 that cause that warning too until I gag stderr as I have done above.


19 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

NSApplicationDelegate.applicationSupportsSecureRestorableState: Error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.