Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

missing close-brace error

1,533 views
Skip to first unread message

Peter Wang

unread,
Oct 21, 2005, 11:04:32 AM10/21/05
to
Hi all,

I have a Tcl/Tk GUI script running on Ubuntu 5.04 Linux platform. it's Tcl
version: 8.4.7 Expect version: 5.42.1. The script has been running &
functinal for quite a long time. Recently there was a weird error when I
started the script from command line, the error would be like this:

Missing Close-brace error while executing (file ./test.tcl line 261)

But the error it compained is nothing do with missing close-brace.(I have
run some syntax checker to check my scripts and there was no mis-match close
brace in both codes and comments). And the same script runs ok on the same
mahcine before.

Most interesting, if I reboot the machine, the script just starts ok
without this error any more.

It has been puzzled me some time. Do you know if it's related to some
defects with Tcl/tk? Could you shed some light how to debug this problem?

Thanks in advance,

Peter


Andreas Leitgeb

unread,
Oct 21, 2005, 11:31:07 AM10/21/05
to
Peter Wang <wkw...@cisco.com> wrote:
> Missing Close-brace error while executing (file ./test.tcl line 261)
> But the error it compained is nothing do with missing close-brace.(I have
> run some syntax checker to check my scripts and there was no mis-match close
> brace in both codes and comments).

It seems like the script has some awry parts in it.
Perhaps it feeds some dynamically, but carelessly
assembled tcl-code to eval or something else.
A syntax-checker of course cannot analyse code that
is assembled only during runtime.

Is the test.tcl script your own code, or is it part
of some package? Is it proprietary code, or can you
post the logical part around line 261 ?

> And the same script runs ok on the same
> mahcine before.

Some external ressource seems to have some impact.
Perhaps it reads some file, making false assumptions
about that file's structure. After a while that other file
would suddenly contain e.g. a character (an open brace
springs to mind) that the script doesn't deal with and
bang.

>
> Most interesting, if I reboot the machine, the script just starts ok
> without this error any more.

Perhaps, during reboot that other file is somehow reset
to a format which your script groks correctly.

These are just wild guesses, but not unlikely...

% eval "{"
missing close-brace

PS: its of course also possible that the syntax-checker
just doesn't recognise that particular error. quite
unlikely but possible. which syntax checker did you use?

Peter Wang

unread,
Oct 21, 2005, 2:44:35 PM10/21/05
to
Andreas,

Thank you for your insightful inputs.

The script starts first with data definition & initialization and proc
definitions and package loading, then it launchs the GUI window. The error
actually generated in the middle of startup of the script before the GUI
window pops up. So I think this part of codes are mostly static and would
behaves same with every lauches of the script.

The is a complex application with main script with about 3000 lines of codes
and calling a few of API packages. The line 261 code is to set a list of the
env variables like belwo,

set AA(envsets) [list PATH HOME LOGNAME USER XAUTHORITY LD_LIBRARY_PATH
EXPECT_LIBRARY HOST DISPLAY PWD SHELL TCLLIBPATH TERM WINDOWID]

Once I got the error, if I remove this line code, the script still reported
a missing close-brace error while shifting the line to somewhere following
line 261.

One thing I'm wondering, what kind of debug information should/can I inspect
next time when I met this script error? Any system trace can i obtain?

Thanks again,
Peter
"Andreas Leitgeb" <a...@gamma.logic.tuwien.ac.at> wrote in message
news:slrndli2d...@gamma.logic.tuwien.ac.at...

Darren New

unread,
Oct 21, 2005, 2:57:40 PM10/21/05
to
Peter Wang wrote:
> One thing I'm wondering, what kind of debug information should/can I inspect
> next time when I met this script error? Any system trace can i obtain?

While it's kind of crude, there's a very useful method for debugging
this sort of thing. Put in "puts" statements at various points, and look
to see what the last one it reached is before it threw the error. If you
got to #5 but not #6, you know something between those is wrong, and you
can narrow it down some more. Assuming you can reproduce the error
reliably, this can focus your attention on the 20 lines of code that's
wrong instead of the 2980 that's right. :-)

--
Darren New / San Diego, CA, USA (PST)
Neither rocks nor slush nor salted rims
shall keep us from our appointed rounds.

Earl Grieda

unread,
Oct 21, 2005, 7:53:16 PM10/21/05
to

"Peter Wang" <wkw...@cisco.com> wrote in message
news:1129906878.318668@sj-nntpcache-5...

I just finished fixing a bug in my code that gave this error. In my case I
was using list operator (foreach) on a string. I thought I had converted
the string to a list, but I hadn't. Specifically, if the string was like
this:

This is an { example to generate the missing close brace error message.

See if your data has a { in it and if you are using list operators on it.


Andreas Leitgeb

unread,
Oct 25, 2005, 10:38:21 AM10/25/05
to
Peter Wang <wkw...@cisco.com> wrote:
> The is a complex application with main script with about 3000 lines of codes
> and calling a few of API packages. The line 261 code is to set a list of the
> env variables like belwo,
> set AA(envsets) [list PATH HOME LOGNAME USER XAUTHORITY LD_LIBRARY_PATH
> EXPECT_LIBRARY HOST DISPLAY PWD SHELL TCLLIBPATH TERM WINDOWID]

> Once I got the error, if I remove this line code, the script still reported
> a missing close-brace error while shifting the line to somewhere following
> line 261.
>
> One thing I'm wondering, what kind of debug information should/can I inspect
> next time when I met this script error? Any system trace can i obtain?

You can run it under "strace" (well, if on linux; truss on solaris;
don't know about windows-pendant) saving away the log to a file, then
look in file what file has last been opened. Perhaps it is the culprit
in the sense of my previous suspicions ...

I fear I can't help much further from distance without knowing
the scripts. You might want to make copies and then modify them,
erasing irrelevant stuff, placing "puts ..." until you find the
real error-position. a complete stacktrace would likely help
too, since the one you wrote earlier didn't look complete to
me (though I can't surely say it wasn't)

0 new messages