S
Shawn Wheatley
I'm trying to troubleshoot a bug in VirtualEnv, but in order to do so
I need to better understand how Python initializes Tkinter.
Setup:
Python 2.6.3 on Windows 7 & Windows XP SP3
Problem:
There is a file called init.tcl that gets loaded when first executing
a Tkinter statement. The file is held in the root of the Python folder
in another folder called "tcl"
C:\Python26\tcl\init.tcl
VirtualEnv does not copy this folder; instead it adds the core libs
folders to the Python path. When running Python from a VirtualEnv,
Tkinter statements fail stating that the init.tcl file can't be found.
The strange thing is that the location of the init.tcl file is not
listed in the expected list of locations. As an experiment, I renamed
the "tcl" folder in C:\Python26 to "tcl2" and tried to run
Tkinter._test(). Here is the results:
Python 2.6.3 (r263rc1:75186, Oct 2 2009, 20:40:30) [MSC v.1500 32 bit
(Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 3749, in _test
root = Tk()
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following
directories:
C:/Python26/lib/tcl8.5 C:/lib/tcl8.5 C:/lib/tcl8.5 C:/library C:/
library C:/
tcl8.5.2/library C:/tcl8.5.2/library
This probably means that Tcl wasn't installed properly.
Note that "C:/Python26/tcl" is not in this list. Renaming "tcl2" back
to "tcl" resolves the problem, but it still doesn't explain to me why
Python is looking in that location in the first place. Can anyone shed
some light on how Python/Tkinter initialization works?
Shawn
I need to better understand how Python initializes Tkinter.
Setup:
Python 2.6.3 on Windows 7 & Windows XP SP3
Problem:
There is a file called init.tcl that gets loaded when first executing
a Tkinter statement. The file is held in the root of the Python folder
in another folder called "tcl"
C:\Python26\tcl\init.tcl
VirtualEnv does not copy this folder; instead it adds the core libs
folders to the Python path. When running Python from a VirtualEnv,
Tkinter statements fail stating that the init.tcl file can't be found.
The strange thing is that the location of the init.tcl file is not
listed in the expected list of locations. As an experiment, I renamed
the "tcl" folder in C:\Python26 to "tcl2" and tried to run
Tkinter._test(). Here is the results:
Python 2.6.3 (r263rc1:75186, Oct 2 2009, 20:40:30) [MSC v.1500 32 bit
(Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\lib-tk\Tkinter.py", line 3749, in _test
root = Tk()
File "C:\Python26\lib\lib-tk\Tkinter.py", line 1643, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, want
objects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following
directories:
C:/Python26/lib/tcl8.5 C:/lib/tcl8.5 C:/lib/tcl8.5 C:/library C:/
library C:/
tcl8.5.2/library C:/tcl8.5.2/library
This probably means that Tcl wasn't installed properly.
Note that "C:/Python26/tcl" is not in this list. Renaming "tcl2" back
to "tcl" resolves the problem, but it still doesn't explain to me why
Python is looking in that location in the first place. Can anyone shed
some light on how Python/Tkinter initialization works?
Shawn