When inside an interp we want to load Tk, we get an error
%interp create "myinterp"
myterp
% myinterp eval "package require Tk"
attempt to provide package Tk 8.5 failed: package Tk 8.5a6 provided instead
It's not a big problem, because I can catch it, but it's annoying.
Logged In: YES
user_id=80530
Originator: NO
I cannot reproduce this with the
released versions of Tcl/Tk 8.5a6.
The symptom presented indicates
a bug in Tk's [package ifneeded] command.
A possibility is that you have an out
of date Tk installed (possibly in addition
to the one you think you are testing?)
After the error message appears,
what does
myinterp eval {package verions Tk}
return?
Logged In: YES
user_id=340696
Originator: YES
% myinterp eval {package versions Tk}
8.5
I'm running "base-tk-thread-win32-ix86.exe" from ActiveTcl 8.5b7. The exe file ProductVersion sais 8.5a6.
Also, if I run a second time the command, I get:
% myinterp eval {package require Tk}
attempt to provide package Tk 8.5 failed: no version of package Tk provided
Logged In: YES
user_id=80530
Originator: NO
um, the ActiveTcl distibutions don't
precisely match any release of Tcl.
They're development snapshot releases.
It's likely they're based on a state
of development before the real 8.5a6
release.
Is there a newer one you can upgrade
to that might clear the problem?
That said, it's still surprising that
Tcl and Tk would not work together
because the snapshots are taken at the
same time, I think.
Continuing the analysis, what does
myinterp eval {package ifneeded Tk 8.5}
return?
Logged In: YES
user_id=340696
Originator: YES
% myinterp eval {package ifneeded Tk 8.5}
if [catch {load "" Tk}] {load C:/fw4_dev/make/buildexe/base-tk-thread-win32-ix86.exe/lib/tk8.5/libtk8.5.so Tk}
And reading the C:/fw4_dev/make/buildexe/base-tk-thread-win32-ix86.exe/lib/tk8.5/pkgIndex.tcl I get:
package ifneeded Tk 8.5 [format {
if [catch {load "" Tk}] {load %s Tk}
} [list [file join $dir libtk8.5.so]]]
By the way, I'm running in Windows XP.
That really looks weird.
Logged In: YES
user_id=80530
Originator: NO
Ok, we've tracked down the bug then.
In that [package ifneeded] command,
the first argument needs to be 8.5a6,
and not 8.5.
Tk's own index script doesn't look
like that.
This incorrect code appears to be
in some extra interface code that's
part of the Tk basekit, so the bug should
be reported to its developers.
Logged In: YES
user_id=340696
Originator: YES
I'll, thanks.
Logged In: YES
user_id=75003
Originator: NO
Note: On Windows Tk is linked statically into the AS base-tk kit. The pkgIndex.tcl is quite bogus, true, it also not used.
Logged In: NO
It appears to still be used
when [package require Tk] is
in a slave interp.
If that's not how it's supposed
to work, then how is the
[package ifneeded] command for
Tk supposed to run in the slave
interp?
Logged In: YES
user_id=80530
Originator: NO
another thing to consider is
that even if Tk is provided
statically, or if a correct
initial [package ifneeded]
command is put into place
referring to the static Tk
in the application, if the
broken pkgIndex.tcl remains
somewhere on the auto_path,
then it's available for
[source]-ing, and once its
[source]d any later
[package require Tk] will
fail due. If no other failure
case is evident, consider what
might happen after a [package forget].