In many cases, the Tcl error messages are so clear that by reading the words carefully, one can pretty much figure out what is needed. However, there are occasionally times when this is not the case. Also, sometimes the error msg in question is from the operating system, but it appears as though the error is coming from Tcl. This page is intended to provide some assistance in those cases.From http://www.psg.com/~joem/tcl/faq.html#SectionD
I start with these questions and answers:- "not found" or "Command not found"
#! /usr/home/homedir/very/long/path/tclsh
# rest of scriptYou can either shorten the path by moving the tclsh executable to a different directory or by using symbolic links. Another option is to not specify the path at all. See the question "How do I make my script executable regardless of the location of tclsh?" for an example of how to do this.- invalid command name "}"
for more info.Another common cause can be the difference between interactive and command modes for Tcl. When you start up a Tcl interpreter, get a prompt, and type in commands to Tcl, this is called interactive mode. In this mode, Tcl does a few extra things for you. For instance, if you type ls, and you have no proc called ls defined, Tcl will try to exec a command called ls. This sometimes misleads a new Tcl user into thinking that Tcl has ls defined. They then copy into a script file the same commands they typed in during interactive mode. This results in the user getting the error:
invalid command name "ls"
while executing
"ls
"
(file "/tmp/t.tcl" line 3)- missing close-brace
- expected integer but got ...
- "Undefined symbol: main" or similar
- "extra characters after close brace while executing" [confirm message text]
proc test {intext}{
puts "hello"
}That is to say - neglects to put a space before the opening brace of the proc's body.- "extra characters after close-quote"
if{$x == 1} {
The correct way should be:
if {$x == 1} {
