can not run a TCL demo python script.

antifod at yahoo.com antifod at yahoo.com
Tue Mar 4 21:59:38 CET 2003


Hello,

I am working on a Win NT machine. I have installed Python in C:/Python
and TCL in C:/Program Files/Tcl. The problem is that I can't run the
demo python script C:\Program Files\Tcl\demos\Tktable\tktable.py from
Python. The script exits with an error message in the following
sequence of statements
:----------
        try:
            master.tk.call('package', 'require', 'Tktable')
        except Tkinter.TclError:
            master.tk.call('load', '', 'Tktable')
The error that it throws is
:----------
  File "C:\Program Files\Tcl\demos\Tktable\tktable.py", line 68, in
__init__
    master.tk.call('load', '', 'Tktable')
TclError: package "Tktable" isn't loaded statically
:----------

I tried the following variant of the above code\
:---------------
        master.tk.call('package', 'require', 'Tktable')
##        except Tkinter.TclError:
##            master.tk.call('load', '', 'Tktable')
        Tkinter.Widget.__init__(self, master, 'table', cnf, kw)
:----------------
.. and it threw the following error
:--------
  File "C:\Program Files\Tcl\demos\Tktable\tktable.py", line 66, in
__init__
    master.tk.call('package', 'require', 'Tktable')
TclError: can't find package Tktable
:--------

So, the problem looks like a path configuration problem. The *.tcl
scripts in the directory as the *.py script run just fine under TCL. I
have edited the PYTHONPATH environment to include the TCL\demos,
TCL\bin, TCL\lib, and TCL\include directories.

Does anybody know where TCL/TK gets its path to search packages from?
In this case for example, I don't know which file TK is trying to
"require". Is it one of the files in the tcl/include, tcl/lib or
another directory altogether?

-Ajo.




More information about the Python-list mailing list