Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


"can not find channel named" error

"can not find channel named" error

"can not find channel named" error

Dear all,

I use Tip 86 to trace execution of script and like to print the traced info of everyline through my own procedure call print_lines. Script throws error , when i try to open a file and access the contents.

Note 1: Instead of proc call "print_lines", if i specify standard channel "stdout". script executes smoothly.

Code :
proc print_lines { args } {

puts "Argument List : $args"

trace execution print_lines

set fd [ open "/tmp/user/hello.txt" "r" ]

while { [ gets $fd readdata ] != -1 } {

puts $readdata

close $fd

Error : "can not find channel named print_lines "file5

Thanks for all your solutions in advance....

RE: "can not find channel named" error

I think you're not using "trace" correctly. I see the syntax as: trace add execution name ops commandPrefix
where from the Docs:

Quote (TclHelp)

Arrange for commandPrefix to be executed (with additional arguments) whenever command name is executed, with traces occurring at the points indicated by the list ops. Name will be resolved using the usual namespace resolution rules used by commands. If the command does not exist, an error will be thrown.

Bob Rashkin

RE: "can not find channel named" error

I use the trace syntax available in the TIP( TCL improvement Proposal )86.

trace execution

A new execution subcommand to the trace command.

trace execution target ?level?

This arranges for an execution trace to be setup for commands at nesting level or above, thereby providing a simple Tcl interface for tracing commands to say, implement a debugger. With no arguments, the current target is returned. If target is the empty string, the execution trace is removed. The target argument is assumed to be a command string to be executed. When level is not specified, it defaults to 0, meaning trace all commands. For each traced command, the following data will be produced:


The line number the instruction begins on.


The fully normalized file name.


The nesting level of the command.


The stack call level as per info level.


The current fully qualified namespace/function.


The fully qualified command name of the command to be invoked.


The command line to be executed including arguments.


Integer bit flags, currently bit 1 is set for breakpoint.

The target is presumed to be a valid Tcl command onto which is appended the above arguments before evaluation. Any return from the command other than a normal return results in the command not being executed. As with all traces, execution tracing is disabled within a trace handler.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close