Tcl/Tk Path problems in Python 1.5.2 installation

Tim Peters tim_one at email.msn.com
Fri Jan 14 17:53:17 EST 2000


[David Nichols]
> I just installed python 1.5.2 (running py152.exe and
> answering 'yes - I want to install Tcl/Tk')

Would help to know which OS; Win95/98 are generally more trouble than NT.
I'm guessing you're not using NT.

> and have been unable to get the path set up correctly
> for graphical applications.  For instance, if I go to the
> idle directory (//E/Programs/Py152/Tools/idle) and try to
> launch it I get the following result.

That's one clue:  you installed Python into a "non-standard" location.  So
you probably put Tcl/Tk somewhere unexpected too.

> ============================================================
> BASH.EXE-2.02$ python idle.py

OK, you're not running one of the Windows shells.

There's also an implication that you've fiddled your system path in some way
(else python would not have been found from a prompt in the IDLE directory).

To make life easier on yourself, don't try to debug this by running IDLE;
instead get into an interactive cmdline shell Python and type

>>> import Tkinter
>>> Tkinter._test()

You'll know that this is working (and then IDLE will too) when a little
window pops up in response.

In fact, there's no evidence of a problem with Python, so you could probably
cut Python out of the loop entirely and just try to get Tcl's Wish shell
working instead (Start -> Programs -> Tcl -> Wish).

> Traceback (innermost last):
> ...
> TclError: Can't find a usable init.tcl in the following
> directories:
>     {} ./lib/tcl8.0
>     .
>     E:/Programs/Py152/tcl8.0/library
>     E:/Programs/Py152/Tools/library

This msg comes from Tcl, so Python found Tcl, and Tcl *started* to execute.
Tcl is telling you which directories it looked in for one of its own startup
files.   So you have to change Tcl's view of which directories to look in --
or change your directories to match Tcl's view.

> The directories in sys.path are as follows ...
> E:\PROGRAMS\PY152
> [etc]

These don't matter (at least not at this point):  Tcl is a separate
language, and doesn't know anything about Python's sys.path.  As the msg
said, "This probably means that Tcl wasn't installed properly" -- which, of
course, doesn't mean that it wasn't installed properly <wink>.

> Tcl in installed in E:\PROGRAMS\Py152\\Tcl, and init.tcl
> exists in
> E:\PROGRAMS\Py152\Tcl\lib\tcl8.0 ...
> but this directory does not seem to be searched.

Right, the Tcl msg above did not list this directory.

> Do I need to set additional environmental variables or
> make changes to the registry beyond those made by the
> installer?

It's hard to say without rummaging around your machine.  The "init.tcl"
flavor of failure is rare, and *may* be due to having installed some other
version of Tcl in the past.  Scriptics has changed their mind about where
Tcl "should be" installed, and older installations leave crucial Tcl DLLs in
the system directories where they may confuse later installations.

A description of Tcl envars you can try setting:

    http://www.pythonware.com/people/fredrik/fyi/fyi02.htm

If that doesn't fix it, I would uninstall Python, Tcl and Tk (using
Add/Remove Programs); ruthlessly track down and destroy (at least rename to
harmlessness) every file matching tk*.dll and tcl*.dll on your machine; and
try again.

it-will-work-in-the-end-no-matter-how-long-that-takes-ly y'rs
    - tim






More information about the Python-list mailing list