I installed python3.9 with
sudo apt install python3.9
Then Idle with
sudo apt install idle-python3.9
When I try to run idle-python3.9, I get the following traceback:
Traceback (most recent call last):
File "/usr/bin/idle-python3.9", line 3, in <module>
from idlelib.pyshell import main
File "/usr/lib/python3.9/idlelib/pyshell.py", line 53, in <module>
from idlelib.editor import EditorWindow, fixwordbreaks
File "/usr/lib/python3.9/idlelib/editor.py", line 19, in <module>
from idlelib import configdialog
File "/usr/lib/python3.9/idlelib/configdialog.py", line 26, in <module>
from idlelib.config_key import GetKeysDialog
File "/usr/lib/python3.9/idlelib/config_key.py", line 7, in <module>
from tkinter.simpledialog import _setup_dialog
ImportError: cannot import name '_setup_dialog' from 'tkinter.simpledialog'
(/usr/lib/python3.9/tkinter/simpledialog.py)
Sure enough, there is no such method in tkinter.simpledialog. Grepping around, I found the following python files were trying to do the import:
/usr/lib/python3.9/idlelib/config_key.py
/usr/lib/python3.9/idlelib/searchbase.py
/usr/lib/python3.9/idlelib/query.py
Why the mismatch between the idlelib files and idle-python3.9 when they are the same version, installed together I believe. How do I fix this? I'm a newb... thanks in advance.
There is a mismatch between the 3.9.5 version of IDLE you have, which calls the function added to tkinter.simpledialog in 3.9.5, and the older version of tkinter you must have. You must need to install something like thinkter-python3.9 to get the updated tkinter. Or maybe the Mint people neglected to include the 3.9.5 version of tkinter with 3.9.5 python.
IDLE and tkinter should really not be installed separately, or if they are, the IDLE installer should check the tkinter version. Please inform the Mint people about this bug. I hope it does not infect Ubuntu also. (The python.org installers for Windows and Mac do install or not both tkinter and IDLE so that there is no issue with a mismatch.)
In any case, the new function is
def _setup_dialog(w):
if w._windowingsystem == "aqua":
w.tk.call("::tk::unsupported::MacWindowStyle", "style",
w, "moveableModal", "")
elif w._windowingsystem == "x11":
w.wm_attributes("-type", "dialog")
added at line 259. The function and multiple calls to the function were added by https://github.com/python/cpython/commit/9a165399aec930f27639dd173426ccc33586662b for https://bugs.python.org/issue43655 and https://github.com/python/cpython/pull/25588.
PS: 'idle-python3.9 is an installation name, not something you run. One run python.exe or python3.exe, depending on the system, or one runs IDLE with python(3).exe.