[Patches] [ python-Patches-470433 ] Python shouldn't clobber TCL_LIBRARY
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 11 Oct 2001 17:50:54 -0700
Patches item #470433, was opened at 2001-10-11 16:51
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=470433&group_id=5470
Category: Tkinter
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Internet Discovery (idiscovery)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python shouldn't clobber TCL_LIBRARY
Initial Comment:
Python shouldn't clobber TCL_LIBRARY and TK_LIBRARY if they already exist.
It means that a given Python executable, or any executable frozn from it
will only work with the installed Tk/Tcl. This is especially a problem when
the installed Tk is broke (Active state build 210). The patch is to FixTk.py,
and you can safely look for Tix too in case that becomes a part of standard
distributions in the future.
import sys, os, _tkinter
ver = str(_tkinter.TCL_VERSION)
for t in "tcl", "tk", "tix":
if not os.environ.haskey(t.upper() + "_LIBRARY"):
v = os.path.join(sys.prefix, "tcl", t+ver)
if os.path.exists(os.path.join(v, "tclIndex")):
os.environ[t.upper() + "_LIBRARY"] = v
----------------------------------------------------------------------
>Comment By: Internet Discovery (idiscovery)
Date: 2001-10-11 17:50
Message:
Logged In: YES
user_id=33229
Sorry, that should be:
import sys, os, _tkinter
ver = str(_tkinter.TCL_VERSION)
for t in "tcl", "tk", "tix":
try:
v = os.environ[t.upper() + "_LIBRARY"]
except KeyError:
v = os.path.join(sys.prefix, "tcl", t+ver)
if os.path.exists(os.path.join(v, "tclIndex")):
os.environ[t.upper() + "_LIBRARY"] = v
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=470433&group_id=5470