Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secure coding is not enabled for restorable state! WARNING on Mac OS Sonoma 14.0 #110950

Closed
eamarten opened this issue Oct 16, 2023 · 28 comments
Closed
Assignees
Labels
OS-mac pending The issue will be closed if no feedback is provided topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@eamarten
Copy link

eamarten commented Oct 16, 2023

Bug report

Bug description:

With turtle_test.py containing

from turtle import home
home()

running

python turtle_test.py

outputs:

2023-10-17 08:21:27.948 Python[19831:20908209] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

@eamarten eamarten added the type-bug An unexpected behavior, bug, or error label Oct 16, 2023
@terryjreedy
Copy link
Member

For anyone's information, turtle.home should turtle screen to appear with the turtle at the home (origin) position and orientation.

@ronaldoussoren
Copy link
Contributor

Minimal reproducer: import tkinter; tkinter.Tk().

This is a problem in Tk, not in Tkinter as we don't use Cocoa in the Tkinter source code.

@terryjreedy terryjreedy added the pending The issue will be closed if no feedback is provided label Oct 17, 2023
@ugandhar84
Copy link

i'm also facing same error - do we have nay resolution for this?

@aivarannamaa
Copy link
Contributor

I just created a ticket in Tcl/Tk project: https://core.tcl-lang.org/tk/tktview/10b38a7a7c13235296cb0fbc6205f591d5ed15a4

@SimpungaElias
Copy link

what to do with this error?

@aivarannamaa
Copy link
Contributor

It looks just a warning to me. I haven't seen any misbehaviour in my app after upgrading to Sonoma. So I guess for now you can just ignore it.

@ronaldoussoren
Copy link
Contributor

It looks just a warning to me. I haven't seen any misbehaviour in my app after upgrading to Sonoma. So I guess for now you can just ignore it.

That's correct, this is just a warning from a system library about using functionality that's deprecated in macOS Sonoma.

@SimpungaElias
Copy link

I am using PyCharm, so the problem is that the UI is not working, all parameters are set well, but all I am seeing is white color background

@BenjaminIsMyName
Copy link

Minimal reproducer with pygame:

import pygame

pygame.init()
screen = pygame.display.set_mode((800, 600))

@chrstphrchvz
Copy link
Contributor

I am using PyCharm, so the problem is that the UI is not working, all parameters are set well, but all I am seeing is white color background

@SimpungaElias, that issue sounds unrelated to the Secure coding is not enabled for restorable state! warning.

@chrstphrchvz
Copy link
Contributor

chrstphrchvz commented Oct 18, 2023

Upstream Tcl/Tk has implemented the method suggested by the warning. I have verified that doing so prevents the warning in Tcl/Tk. However, I currently do not have a Python framework build which I can both observe the warning from Tkinter and see whether the upstream fix makes a difference.

I have opened #111041 in case Python is interested in backporting the upstream fix to the macOS installers, and assuming it does work for Tkinter.

@Pablosarti7
Copy link

Pablosarti7 commented Oct 23, 2023

Did anyone find a solution to this problem? Also this problem started popping up when I installed Pyinstaller.

@pauldebeurs
Copy link

I work with Python 3.11.1 and I use matplotlib.pyplot.
Since Sonoma 14.0 I get a warning: Secure coding is not enabled for restorable state!
When I don't plot there is no warning.
Can Apple resolve this for us?

@Heilige-49
Copy link

I work with Python 3.11.1 and I use matplotlib.pyplot. Since Sonoma 14.0 I get a warning: Secure coding is not enabled for restorable state! When I don't plot there is no warning. Can Apple resolve this for us?

I am facing the same issue and don't really know how to fix it

@ronaldoussoren
Copy link
Contributor

I work with Python 3.11.1 and I use matplotlib.pyplot. Since Sonoma 14.0 I get a warning: Secure coding is not enabled for restorable state! When I don't plot there is no warning. Can Apple resolve this for us?

I am facing the same issue and don't really know how to fix it

This is warning, not an error and therefore you don't have to do anything. The cause for the warning is fixed in the codebase of Tcl/Tk and will be included in a future release of Tcl/Tk and then in a future release of Python.

@Heilige-49
Copy link

Heilige-49 commented Nov 14, 2023 via email

@ericsuchagenius
Copy link

wait guys i also have this problem, when i implement tkinter even though it pops up a showing window, there is nothing on it even though i followed the steps, but it is just not printing, in the console, there is this line of warning which is simular to the description above.

from tkinter import *
root = Tk()
myLabel = Label(root,text="helloworld")
myLabel.pack()
root.mainloop()

@KKorionKK
Copy link

I also had such a warning, but only when working with matplotlib

@benjiprores
Copy link

wait guys i also have this problem, when i implement tkinter even though it pops up a showing window, there is nothing on it even though i followed the steps, but it is just not printing, in the console, there is this line of warning which is simular to the description above.

from tkinter import * root = Tk() myLabel = Label(root,text="helloworld") myLabel.pack() root.mainloop()

Yes also having the same problem here…
When are they going to fix this!!

@Heilige-49
Copy link

wait guys i also have this problem, when i implement tkinter even though it pops up a showing window, there is nothing on it even though i followed the steps, but it is just not printing, in the console, there is this line of warning which is simular to the description above.
from tkinter import * root = Tk() myLabel = Label(root,text="helloworld") myLabel.pack() root.mainloop()

Yes also having the same problem here… When are they going to fix this!!

I am facing the same issue and I am fed up. I decided to use Pycharm and it works swiftly.

ned-deily added a commit that referenced this issue Nov 21, 2023
Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (gh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (gh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (gh-110950)

Co-authored-by: Ned Deily <nad@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 21, 2023
…111041)

Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (pythongh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (pythongh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (pythongh-110950)

(cherry picked from commit d67f947)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Ned Deily <nad@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 21, 2023
…111041)

Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (pythongh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (pythongh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (pythongh-110950)

(cherry picked from commit d67f947)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Ned Deily <nad@python.org>
ned-deily added a commit that referenced this issue Nov 21, 2023
… (#112293)

Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (gh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (gh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (gh-110950)

(cherry picked from commit d67f947)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Ned Deily <nad@python.org>
ned-deily added a commit that referenced this issue Nov 21, 2023
… (#112294)

Add upstream Tk patches for three problems affecting tkinter users:

- Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed. (gh-92603)

- Update macOS installer to include an upstream Tcl/Tk fix
for the ``ttk::ThemeChanged`` error encountered in Tkinter. (gh-71383)

- Update macOS installer to include an upstream Tcl/Tk fix for the
``Secure coding is not enabled for restorable state!`` warning
encountered in Tkinter on macOS 14 Sonoma. (gh-110950)

(cherry picked from commit d67f947)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-authored-by: Ned Deily <nad@python.org>
@ned-deily
Copy link
Member

Thanks for the PR. The fix for Tk in the macOS installer has now been merged for release in 3.13.0a2, 3.12.1, and 3.11.7.

@iDevSpread
Copy link

I am using PyCharm, so the problem is that the UI is not working, all parameters are set well, but all I am seeing is white color background

I got the same issue, too. Do you fix it?

@Heilige-49
Copy link

Heilige-49 commented Dec 4, 2023 via email

@u-aida
Copy link

u-aida commented Dec 13, 2023

I got same error pysimplegui with matplotlib.

My environment configuration is
Python: 3.12 (Because of pysimplegui do not work with SONOMA)
Mac OS: 14.2 (Preview version of Sonoma had same issue)

Python problem is happened after I update to Sonoma.

@ned-deily
Copy link
Member

@u-aida: Note above: "The fix for Tk in the macOS installer has now been merged for release in 3.13.0a2, 3.12.1, and 3.11.7." And this only applies to those Pythons for macOS downloadable from the python.org website. If you are using a Python from another source, contact its distributor and ask them to update their version of Tk.

@Wangsd823
Copy link

Wangsd823 commented Dec 18, 2023

wait guys i also have this problem, when i implement tkinter even though it pops up a showing window, there is nothing on it even though i followed the steps, but it is just not printing, in the console, there is this line of warning which is simular to the description above.

from tkinter import * root = Tk() myLabel = Label(root,text="helloworld") myLabel.pack() root.mainloop()

I had the same problem.

Python: 3.9.6
Tkinter: 8.5
Mac OS: 14.2

@ned-deily
Copy link
Member

ned-deily commented Dec 18, 2023

I had the same problem.

Python: 3.9.6 Tkinter: 8.5 Mac OS: 14.2

There seems to be a lot of confusion and conflation of issues here. This issue is closed and was about the secure coding warning that may be seen when using currently released versions of Tk, which is what Python's tkinter uses as a GUI library, on macOS 14 Sonoma. This message is only a warning and can be ignored. As noted above, a patch to eliminate the warning has been applied to the Tk released with the most recent python.org macOS installers (for 3.13.0a2, 3.12.1, and 3.11.7). If you use Python on macOS from another source, the Tk versions used by them would need to be patched to eliminate the warning.

Any other behavior you may be seeing is a different problem, unrelated to this issue. It might be a Tk problem or it might be a Python problem or it might be a usage problem, but it is not this problem. Anyone wanting to pursue another problem should follow the usual procedures, like looking for help in one of the many forums and checking the Python and Tk issue trackers for similar reports.

In this particular case, be aware that Tk 8.5 is extremely old and unsupported and likely has many problems on more recent macOS releases but unfortunately is still shipped by Apple in macOS and is used by the python3 supplied with Xcode and the Command Line Tools. Python 3.9.6 is also very old and 3.9 is now in the security-fix-only phase of its life cycle: the most recent release of Python 3.9 is 3.9.18 and the last full bugfix release with binary installers was 3.9.13. Python 3.11.x and 3.12.x are the current fully-supported release versions.

@python python locked as resolved and limited conversation to collaborators Dec 18, 2023
@ronaldoussoren
Copy link
Contributor

Note that /usr/bin/python3 also loudly complains about the usage of tkinter:

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.

It is highly unlikely that Apple will ever fix issues like this with Tk or upgrade Tk to a newer version. If you want to use Tkinter with Python you need to install a newer version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
OS-mac pending The issue will be closed if no feedback is provided topic-tkinter type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests