winfo_pathname gives an exception on 64-bit Python on Microsoft Windows. The script below shows the exception for 64-bit Python, and runs without exception on 32-bit Python. Both 64-bit and 32-bit wish86, compiled from source by 'Command Prompt for VS 2017', runs are fine. Reading 'winfo pathname' entry in the Tk man page for winfo makes me think '... does not give an exception on 32-bit ...' may be a better title for this issue. However I like to think the 'winfo pathname' entry is poorly drafted: which implies a problem in tkinter for the 64-bit version. The winfo_name and winfo_parent methods provide a workaround to get the pathname, so the problem is not as serious as not being warned it exists. Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\roger> cat winfo_id.py import sys import tkinter print(sys.version) button = tkinter.Button() print(button) i = button.winfo_id() print(i) p = button.winfo_pathname(i) print(p) PS C:\Users\roger> PS C:\Users\roger> echo "Python3.10 because that is what the msys2 installation uses." Python3.10 because that is what the msys2 installation uses. PS C:\Users\roger> PS C:\Users\roger> py -3.10-32 -m winfo_id 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] .!button 917632 .!button PS C:\Users\roger> PS C:\Users\roger> py -3.10-64 -m winfo_id 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] .!button 983168 Traceback (most recent call last): File "C:\Users\roger\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\roger\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\roger\winfo_id.py", line 8, in p = button.winfo_pathname(i) File "C:\Users\roger\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1159, in winfo_pathname return self.tk.call(args) _tkinter.TclError: window id "983168" doesn't exist in this application PS C:\Users\roger> PS C:\Users\roger> echo "Python3.12 because it is latest version." Python3.12 because it is latest version. PS C:\Users\roger> PS C:\Users\roger> py -3.12-32 -m winfo_id 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 12:49:59) [MSC v.1935 32 bit (Intel)] .!button 1048704 .!button PS C:\Users\roger> PS C:\Users\roger> py -3.12-64 -m winfo_id 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] .!button 1114240 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\roger\winfo_id.py", line 8, in p = button.winfo_pathname(i) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\roger\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 1186, in winfo_pathname return self.tk.call(args) ^^^^^^^^^^^^^^^^^^ _tkinter.TclError: window id "1114240" doesn't exist in this application PS C:\Users\roger> PS C:\Users\roger> PS C:\Users\roger> echo "Tcl/tk equivalents in wish86 compiled from source." Tcl/tk equivalents in wish86 compiled from source. PS C:\Users\roger> PS C:\Users\roger> ls tcltk32\bin Directory: C:\Users\roger\tcltk32\bin Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 08/01/2024 19:47 1342976 tcl86t.dll -a---- 08/01/2024 19:47 69120 tclsh86t.exe -a---- 08/01/2024 19:52 1214976 tk86t.dll -a---- 08/01/2024 19:53 55808 wish86t.exe PS C:\Users\roger> .\tcltk32\bin\wish86t.exe PS C:\Users\roger> PS C:\Users\roger> ls tcltk64\bin Directory: C:\Users\roger\tcltk64\bin Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 08/01/2024 19:57 1711616 tcl86t.dll -a---- 08/01/2024 19:57 70144 tclsh86t.exe -a---- 08/01/2024 20:01 1487360 tk86t.dll -a---- 08/01/2024 20:01 57856 wish86t.exe PS C:\Users\roger> .\tcltk64\bin\wish86t.exe PS C:\Users\roger> PS C:\Users\roger> cat copy_and_paste_wich86_consoles.txt cat : Cannot find path 'C:\Users\roger\copy_and_paste_wich86_consoles.txt' because it does not exist. At line:1 char:1 + cat copy_and_paste_wich86_consoles.txt + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Users\roger\...86_consoles.txt:String) [Get-Content], ItemNotFoundEx ception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand PS C:\Users\roger> cat copy_and_paste_wish86_consoles.txt (roger) 1 % package require platform 1.0.18 (roger) 2 % platform::identify win32-x86_64 (roger) 3 % set b [button .hello] .hello (roger) 4 % set i [winfo id $b] 0xc01be (roger) 5 % set p [winfo pathname $i] .hello (roger) 6 % info tclversion 8.6 (roger) 7 % (roger) 1 % package require platform 1.0.18 (roger) 2 % platform::identify win32-ix86 (roger) 3 % set b [button .hello] .hello (roger) 4 % set i [winfo id $b] 0x7016a (roger) 5 % set p [winfo pathname $i] .hello (roger) 6 % info tclversion 8.6 (roger) 7 % PS C:\Users\roger> PS C:\Users\roger> echo "Now the msys2 versions from Python." Now the msys2 versions from Python. PS C:\Users\roger> PS C:\Users\roger> cat msys2_mingw32 Script started on 2024-01-08 21:11:54+00:00 [TERM="xterm" TTY="/dev/pty1" COLUMNS="100" LINES="27"] roger@DESKTOP-49QTB4T MINGW32 /c/Users/roger $ python P Python 3.10.11 (main, Apr 7 2023, 17:44:31) [GCC 12.2.0 32 bit] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> exit() roger@DESKTOP-49QTB4T MINGW32 /c/Users/roger $ python -m winfo_id 3.10.11 (main, Apr 7 2023, 17:44:31) [GCC 12.2.0 32 bit] .!button 1442414 .!button roger@DESKTOP-49QTB4T MINGW32 /c/Users/roger $ exit exit Script done on 2024-01-08 21:12:51+00:00 [COMMAND_EXIT_CODE="0"] PS C:\Users\roger> [50;1R At line:1 char:2 + [50;1R + ~ Missing type name after '['. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingTypename PS C:\Users\roger> PS C:\Users\roger> cat msys2_mingw64 Script started on 2024-01-08 21:16:17+00:00 [TERM="xterm" TTY="/dev/pty1" COLUMNS="100" LINES="27"] roger@DESKTOP-49QTB4T MINGW64 /c/Users/roger $ python P Python 3.10.11 (main, Apr 7 2023, 17:44:59) [GCC 12.2.0 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> exit() roger@DESKTOP-49QTB4T MINGW64 /c/Users/roger $ python -m winfo_id 3.10.11 (main, Apr 7 2023, 17:44:59) [GCC 12.2.0 64 bit (AMD64)] .!button 1180964 Traceback (most recent call last): File "C:/msys64/mingw64/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:/msys64/mingw64/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "C:/Users\roger/winfo_id.py", line 8, in p = button.winfo_pathname(i) File "C:/msys64/mingw64/lib/python3.10/tkinter/__init__.py", line 1159, in winfo_pathname return self.tk.call(args) _tkinter.TclError: window id "1180964" doesn't exist in this application roger@DESKTOP-49QTB4T MINGW64 /c/Users/roger $ exit exit Script done on 2024-01-08 21:17:51+00:00 [COMMAND_EXIT_CODE="1"] PS C:\Users\roger> PS C:\Users\roger> PS C:\Users\roger> echo "Could not figure how to get wish86 script from msys2 sessions." Could not figure how to get wish86 script from msys2 sessions. PS C:\Users\roger> PS C:\Users\roger> PS C:\Users\roger> echo "OpenBSD script for Python3.10 and wish8.6 sessions." OpenBSD script for Python3.10 and wish8.6 sessions. PS C:\Users\roger> PS C:\Users\roger> cat openbsd_winfo_id Script started on Mon Jan 8 21:31:14 2024 opendev$ cat winfo_id.py import sys import tkinter print(sys.version) button = tkinter.Button() print(button) i = button.winfo_id() print(i) p = button.winfo_pathname(i) print(p) opendev$ opendev$ python3.10 Python 3.10.13 (main, Oct 5 2023, 16:21:31) [Clang 13.0.0 ] on openbsd7 Type "help", "copyright", "credits" or "license" for more information. >>> exit() opendev$ opendev$ python3.10 -m winfo_id 3.10.13 (main, Oct 5 2023, 16:21:31) [Clang 13.0.0 ] .!button 33554446 .!button opendev$ opendev$ wish8.6 % package require platform 1.0.19 % platform::identify openbsd-amd64 % set b [button .hello] .hello % set i [winfo id $b] 0x0200000f % set p [winfo pathname $i] .hello % info tclversion 8.6 % exit opendev$ exit Script done on Mon Jan 8 21:35:16 2024 PS C:\Users\roger> PS C:\Users\roger> PS C:\Users\roger> echo "Current version of my workaround." Current version of my workaround. PS C:\Users\roger> echo "Do not remember where apparently odd name PROCESSOR_ARCHITEW6432 came from." Do not remember where apparently odd name PROCESSOR_ARCHITEW6432 came from. PS C:\Users\roger> echo "Does not work for '.' window." Does not work for '.' window. PS C:\Users\roger> PS C:\Users\roger> cat workarounds.py import os _amd64 = ( os.getenv("PROCESSOR_ARCHITECTURE") == "AMD64" or os.getenv("PROCESSOR_ARCHITEW6432") == "AMD64" ) def winfo_pathname(widget, error): """Hack winfo_pathname to cope with exception on Microsoft Windows.""" if (sys.platform == "win32" and _amd64) or sys.platform == "darwin": return ".".join((widget.winfo_parent(), widget.winfo_name())) else: raise RuntimeError( " ".join((sys.platform, "winfo_pathname(id) call")) ) from error PS C:\Users\roger> PS C:\Users\roger>