This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter application doesn't run from source build on Windows
Type: behavior Stage: patch review
Components: Library (Lib), Tkinter, Windows Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: gpolo, pitrou, vinay.sajip
Priority: normal Keywords: needs review, patch

Created on 2012-05-08 11:43 by vinay.sajip, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
copy_tcl.bat.txt vinay.sajip, 2012-05-08 22:00 Batch file to copy Tcl/Tk DLLs to build directory
Messages (8)
msg160198 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 11:43
I'm now getting failures to import tkinter on Windows:

C:\Users\Vinay\Projects\scratch>..\cpython\PCbuild\python tkhello.py
Traceback (most recent call last):
  File "tkhello.py", line 1, in <module>
    from tkinter import *
  File "<frozen importlib._bootstrap>", line 977, in _find_and_load
  File "<frozen importlib._bootstrap>", line 596, in load_module
  File "<frozen importlib._bootstrap>", line 262, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 484, in _load_module
  File "C:\Users\Vinay\Projects\cpython\lib\tkinter\__init__.py", line 36, in <module>
    from tkinter import _fix
ImportError: cannot import name _fix

I'm not sure if this is an importlib issue or a tkinter one, but with a recent build (30 April) this worked OK. The tkhello.py script is just

from tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()
msg160201 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-08 12:39
For the record, the script works fine under Linux.
Vinay, can you bisect and find out which revision introduced the issue?
msg160207 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2012-05-08 15:17
Reproduced here as well.
msg160218 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 19:01
I went back a fair way, and the failure still keeps happening. So now I'm wondering - is a Tk app *supposed* to work from a source build?

I've verified that the test script works OK when run from an installed Python.

So, this issue may be invalid, if we don't care about running Tk apps from a source build (if so, sorry for the noise) - or if we do care, then it's not an importlib issue, but Tk-related (I'm not a Tk expert by any means, so I'm not sure what needs to be done to make a Tk app work from a source build).
msg160219 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-08 19:03
> I went back a fair way, and the failure still keeps happening. So now
> I'm wondering - is a Tk app *supposed* to work from a source build?

Does it work with 3.2?
Did you try debugging at the prompt? e.g. looking what tkinter.__file__
is, etc.
msg160223 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 20:27
> Does it work with 3.2?

I'm not able to build 3.2 - make_buildinfo fails, seemingly because it can't find some Subversion-related files. I'll keep looking into it.
msg160231 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-05-08 22:00
The test script works if tcl85.dll and tk85.dll are copied into the build directory. This can be done using a small batch file and the XML

<Tool
    Name="VCPostBuildEventTool"
    CommandLine="copy_tcl $(tcltkDir)\bin"
/>

added to each build configuration in PCbuild\_tkinter.vcproj (can be added through the UI, of course).
msg222665 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-10 13:40
Presumably out of date as we're now on 3.5.
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 58955
2019-04-26 18:50:26BreamoreBoysetnosy: - BreamoreBoy
2014-07-10 13:41:57brian.curtinsetnosy: - brian.curtin
2014-07-10 13:40:15BreamoreBoysetnosy: + BreamoreBoy
messages: + msg222665
2012-05-08 22:00:19vinay.sajipsetfiles: + copy_tcl.bat.txt

components: + Tkinter
title: importlib fails with tkinter application on Windows -> Tkinter application doesn't run from source build on Windows
keywords: + patch, needs review
nosy: + gpolo, - brett.cannon
messages: + msg160231
stage: patch review
2012-05-08 20:27:10vinay.sajipsetmessages: + msg160223
2012-05-08 19:03:38pitrousetmessages: + msg160219
2012-05-08 19:01:25vinay.sajipsetmessages: + msg160218
2012-05-08 15:17:23brian.curtinsetmessages: + msg160207
2012-05-08 12:39:49pitrousetnosy: + brian.curtin, pitrou
messages: + msg160201
2012-05-08 11:43:28vinay.sajipcreate