Re: Tcl script fails on some platforms



On 31 jul, 10:32, hrp1...@xxxxxxxxx wrote:
Hi

I've taken over looking after a relatively big TclTk application
(using [incr] Tcl & Tk + several other packages; it has around 60,000
lines and interfaces with a Fortran/C application with ~300,000 lines,
hence the small sample of code here - if you want more, just ask...),
and have come across a problem that only seems to affect a very small
proportion of users - and I'm stumped. I have had a look around the
web trying to find pointers but have so far been unsuccessful - so I
was hoping someone here could give me an idea of where to start
looking to get to the bottom of this problem.

The following code snippet works for me on any platform I care to try
it on and continues through to the rest of the script. When I say "any
platform", I've been running on Linux RHEL 4, SUSE 9.3, FC6, Ubuntu
7, Mac OSX 10.3 & 10.4 (both Intel and PPC in the latter case),
Windows XP, DEC Alpha Tru64 and possibly a couple of others that I've
forgotten. I have one user for whom it fails when running on FC6.

The installed versions of TclTk depend a bit on which platform/OS, but
are all 8.4.10 - 8.4.14, mostly the ActiveTcl distribution, but the
Tru64 version was built locally.

Does anyone have any ideas as to where I should start looking for an
answer to this? Has anyone come across anything similar?

Anyway, in file 1 I have (with various "puts" included to try to
track the problem) -

# get a filename and location (as full path) from the user
set l_image_file [.addImages get]
puts "this is the image filename: $l_image_file"
# If the user picked a file
if {$l_image_file != ""} {
puts "Okay, the image filename wasn't blank"
# add the image to the current session
$::session addImage $l_image_file
puts "but the code doesn't seem to have reached here"
}

}

In file 2 (where the ::session is defined and implemented) I have -

body Session::addImage { a_image_file } {
puts "check that this is actually being called"
# Check image isn't already present
set l_image [Image::getImageByPath $a_image_file]

This all looks relatively straightforward to me, and indeed, when I
run it on the boxes available to me I get the following output -
------------------------
this is the image filename: /nfs/ls1/harrygrp0/harry/test/camillo/
hg_001.mar1600
Okay, the image filename wasn't blank
check that this is actually being called
but the code doesn't seem to have reached here
============
;-) note that the message in the last line is wrong since the code has
quite clearly "reached here"!

My user gets
-----------------------

this is the image filename: /home/webice/imosflm_test/hg_001.mar1600
Okay, the image filename wasn't blank
invalid command name ""
invalid command name ""
while executing
"$::session addImage $l_image_file"
(object "::.c" method "::Controller::addImages" body line 11)
invoked from within
"::.c addImages"
(in namespace inscope "::Controller" script line 1)
invoked from within
"namespace inscope ::Controller {::.c addImages}"
("uplevel" body line 1)
invoked from within
"uplevel \#0 $itk_option(-command)"
(object "::.c.tbf.images.aitb" method "::Toolbutton::execute" body
line 42)
invoked from within
"::.c.tbf.images.aitb execute"
(in namespace inscope "::Toolbutton" script line 1)
invoked from within
"namespace inscope ::Toolbutton {::.c.tbf.images.aitb execute}"
invoked from within
".c.tbf.images.aitb.button invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list $w invoke]"
(procedure "tk::ButtonUp" line 22)
invoked from within
"tk::ButtonUp .c.tbf.images.aitb.button"
(command bound to event)
============

It seems that for you user the ::session variable is empty. I would
start by puts-ing that session variable and if it is indeed empty
trying to figure out why its is.

Mark

.


Quantcast