Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python 2.6.3 and finding init.tcl

Reply
Thread Tools

Python 2.6.3 and finding init.tcl

 
 
Shawn Wheatley
Guest
Posts: n/a
 
      10-15-2009
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.
>>> import Tkinter
>>> Tkinter._test()

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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding the Min for positive and negative in python 3.3 list Norah Jones Python 12 03-14-2013 11:45 AM
Python (and me) getting confused finding keys John Python 4 12-23-2009 09:01 AM
Finding and copying files with python. gtb Python 7 04-03-2007 02:55 PM
Finding if Python Is Running In Console (python.exe) or Window (pythonw.exe) Chaos Python 1 08-15-2006 12:58 AM
Finding Server... Finding Host.... enough already!!! Leesa_Tay@softhome.net Computer Support 2 01-20-2006 10:23 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57