Version 11 of Debugging Expect programs

Updated 2003-06-06 17:00:42

Expect seems to be particularly prone to the situation that a newcomer writes a script, doesn't get the result he or she expects, and then appears to be completely at a loss as to what to do next. This page dissolves that paralysis.

Chapter 18 of BOOK Exploring Expect is devoted to "Debugging Scripts".

One of the commonest complaints is, "... and that's the pattern I wrote, but Expect isn't doing anything ..." This is often a symptom of a failure to expect the character stream Expect actually sees. A good place to begin, therefore, is often simply to change

    expect myscript.exp

to

    expect -d myscript.exp

The latter invocation provides abundant information about, among other things, the output Expect tries to match. Study of -d reports frequently suffices to solve otherwise-thorny problems.

"What debugging tools are available to a Tcl programmer" includes several outstanding tips.

[exp_internal; Chapters 7, 9, 18, and page 531; ...]


[Explain crucial role of autoexpect. Have beginners start with it.] [Pick appropriate references from FAQ.]


escargo - What I have found useful included log_file and log_user.


[Explain importance of inserting sleep 1 before password transmission, when all else fails.]


Category Debugging | Category Expect