-1

I have a problem with path in a tcl file. I tried to use

source  " /tmp/mob.tcl " 

and this path in bash file :

/opt/ns-allinone-2.35/ns-2.35/indep-utils/cmu-scen-gen/setdest/setdest -v 1 -n $n -p 10 -M 64 -t 100 -x 250 -y 250 >> /tmp/mob.tcl

The terminal give me this output:

    ..."
    (procedure "source" line 8)
    invoked from within
"source  "/tmp/mob.tcl" "
    (file "mobilita_source.tcl" line 125)

How I can do this?

Jerry
  • 70,495
  • 13
  • 100
  • 144
Amiga 500
  • 19
  • 1
  • 9
  • possible duplicate of [Path Tcl and Bash](http://stackoverflow.com/questions/24659881/path-tcl-and-bash) – shellter Jul 10 '14 at 17:24

1 Answers1

2

Firstly, this:

source  " /tmp/mob.tcl " 

is very unlikely to be correct. The spaces around the filename inside the quotes will confuse the source command. (It could be correct, but only if you have a directory in your current directory whose name is a single space. That's really unlikely, unless you're a great deal more evil than I am.)

It really helps a lot if you stop making this error.

Secondly, the error message is both

  • Incomplete, with just an ellipsis instead of a full error on the first line
  • Really worrying, with source claimed to be a procedure (second line of that short trace).

It's legal to make a procedure called source, and sometimes the right thing to do, but if you're doing it then you have to be ever so careful to duplicate the semantics of the standard Tcl command or odd things will happen.

Thirdly, you've got a file of what is apparently generated code, and you're hitting a problem in it, and you're not telling us what is on/around line 125 of the file (the error trace is pretty clear on that front) or in the contents of the source procedure (which is non-standard; the standard source is implemented in C) and you're expecting us to guess what's going wrong for you??? Seriously?


Tcl error traces are usually quite clear enough for you to figure out what went wrong and where. If there's an unclear error, and it didn't come from user code (by calling error or return -code error) then let us know; we'll help (or possibly even change Tcl to make things clearer in the future). But right now, there's a complete shortage of information.

Here's an example of what a normal source error looks like:

% source /tmp/foo/bar/boo
couldn't read file "/tmp/foo/bar/boo": no such file or directory
% puts $errorInfo
couldn't read file "/tmp/foo/bar/boo": no such file or directory
    while executing
"source /tmp/foo/bar/boo"

If a script generates an error directly, it's encouraged to be as clear as that, but we cannot enforce it. Sometimes you have to be a bit of a detective yourself…

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215