ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> expect
expect
Re: [Expect] Expect Digest, Vol 40, Issue 3
by Shishir Ramam other posts by this author
Aug 8 2007 4:39PM messages near this date
view in the new Beta List Site
[Expect] Determining name/paths of source-d files at runtime | [Expect] FW: Error in Expect "spawn id exp5 not open"
On windows, winnt_debug is pretty handy.

Perhaps this'll help isolate the issue.

package require Expect
exp_internal 1
set exp::winnt_debug 1
exp_spawn telnet localhost
expect Login:
exp_send "root\r"




-shishir



On 8/8/07, expect-request@[...].com <
expect-request@[...].com>  wrote:
> 
>  Send Expect mailing list submissions to
>          expect@[...].com
> 
>  To subscribe or unsubscribe via the World Wide Web, visit
>          http://listserv.ActiveState.com/mailman/listinfo/expect
>  or, via email, send a message with subject or body 'help' to
>          expect-request@[...].com
> 
>  You can reach the person managing the list at
>          expect-owner@[...].com
> 
>  When replying, please edit your Subject line so it is more specific
>  than "Re: Contents of Expect digest..."
> 
> 
>  Today's Topics:
> 
>     1. Re: Error in Expect "spawn id exp5 not open" (Rufus Smith)
>     2. Re: Error in Expect "spawn id exp5 not open" (Suresh Sundararaman)
> 
> 
>  ----------------------------------------------------------------------
> 
>  Message: 1
>  Date: Wed, 8 Aug 2007 16:14:25 -0500
>  From: "Rufus Smith" <rufus.smith@[...].com>
>  Subject: Re: [Expect] Error in Expect "spawn id exp5 not open"
>  To: "Stephen Cattaneo" <Stephen.Cattaneo@[...].com>,
>          <expect@[...].com>
>  Message-ID:
>          <
>  254C2F467935F44EAA8E5D5AFE97C3D619103641@[...].com>
>  Content-Type: text/plain; charset="us-ascii"
> 
>  Can you output the contents of the expect buffer?  $expect_out(buffer)?
> 
> 
> 
>  It's possible expect is terminated due to timeout and not due to
>  matching.
> 
> 
> 
>  Can you issue the telnet command manually from the windows command line
>  successfully?
> 
> 
> 
>  I often use expect in a multi-response form, with timeout as one of the
>  options, so I can
> 
>  report back the timeouts: e.g.:
> 
> 
> 
>  send_user "waiting for Project Monitor to start"
> 
> 
> 
>    expect {
> 
>       "Project Name =" { send_user "Saw Project Line \n" ; exp_continue}
> 
>      "Started." { send_user "Got Project start\n"}
> 
>      "\n" { log_window "$expect_out(buffer)"; exp_continue }
> 
>      timeout { send_user "project monitor did not start\n"}
> 
>    }
> 
> 
> 
> 
> 
>  This loop watches the expect stream, outputting all non-matching lines
>  to the log_window function (which
> 
>  uses a label within a grid as a log window.)
> 
> 
> 
>  Here is the function, if you'd like to use it:
> 
> 
> 
>  # lines received
> 
>  set lines 0
> 
> 
> 
>  label .lbllinecount -text "$lines" -justify left
> 
>  label .log_window -width 80 -height 20 -text "<log output here>" -bg
>  white -justify left -anchor sw -font {courier 10}
> 
> 
> 
> 
> 
>  # procedure to use a label as a log window
> 
>  proc log_window {er}  {
> 
>  global lines
> 
> 
> 
>  # ignore blank lines
> 
>  if {[string trimright $er] == ""} {return}
> 
> 
> 
>  # split the label into lines
> 
> 
> 
>  set oldtext [split [lindex [.log_window configure -text] 4 ] "\n"]
> 
> 
> 
>  # keep only the last 50 lines
> 
> 
> 
>  if  {[llength $oldtext] > 50} {lreplace $oldtext 0 0}
> 
> 
> 
>  lappend oldtext [string trimright $er]
> 
> 
> 
>  set oldtext [join $oldtext "\n"]
> 
> 
> 
>  .log_window configure -text "$oldtext"
> 
>  incr lines
> 
>  .lbllinecount configure -text "$lines"
> 
>  }
> 
> 
> 
>  ________________________________
> 
>  From: expect-bounces@[...].com
>  [mailto:expect-bounces@[...].com] On Behalf Of Stephen
>  Cattaneo
>  Sent: Wednesday, August 08, 2007 4:03 PM
>  To: expect@[...].com
>  Subject: Re: [Expect] Error in Expect "spawn id exp5 not open"
> 
> 
> 
>  Try the script with exp_internal  on,  see if that gives you more info.
> 
> 
> 
>  -s
> 
> 
> 
>  ________________________________
> 
>  From: Suresh Sundararaman [mailto:suresh_serc@[...].com]
>  Sent: Wednesday, August 08, 2007 12:57 PM
>  To: Stephen Cattaneo
>  Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"
> 
> 
> 
>  I still get the same error even though i inserted sleep as you told me.
> 
>  ________________________________
> 
>  Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"
>  Date: Wed, 8 Aug 2007 12:13:42 -0700
>  From: Stephen.Cattaneo@[...].com
>  To: suresh_serc@[...].com
> 
>  This is common error with expect.  Trying inserting a few sleeps:
> 
>  package require Expect
>  spawn telnet 192.168.xx.xx
>  expect login:
> 
>  sleep 2
>  send "root\r"
>  expect Password:
> 
>  sleep 2
>  send "admin123\r"
>  expect #
> 
>  sleep 2
>  send "\r"
>  expect #
>  send "show run\r"
>  expect #
> 
> 
> 
>  ________________________________
> 
>  From: expect-bounces@[...].com
>  [mailto:expect-bounces@[...].com] On Behalf Of Suresh
>  Sundararaman
>  Sent: Wednesday, August 08, 2007 12:12 PM
>  To: jeffh@activestate.com; expect@[...].com
>  Subject: [Expect] Error in Expect "spawn id exp5 not open"
> 
> 
> 
>  Jeff / Expect Gurus,
> 
>  I use Windows XP and run basic expect command in the tclsh console of
>  the activestate TCL version 8.4.15.0 and i get an error.
>  I use expect to do a telnet to the gateway and send some commands to
>  config it. But i get an error as "spawn id exp5 not open" when the send
>  command is used.
> 
>  The script is here :
> 
>  package require Expect
>  spawn telnet 192.168.xx.xx
>  expect login:
>  send "root\r"
>  expect Password:
>  send "admin123\r"
>  expect #
>  send "\r"
>  expect #
>  send "show run\r"
>  expect #
> 
>  I get the following error when i run the above file in tclsh console :
> 
>  % source GW_connect.exp
>  child process exited abnormally
>  % send: spawn id exp5 not open
>  %
>  % tclsh GW_connect.exp
>  send: spawn id exp4 not open
>      while executing
>  "send "root\r""
>      (file "GW_connect.exp" line 4)
> 
>  I tried googling but could not find any solution.Can anyone just let me
>  know why this error comes and how can i get out of it and can run the
>  script successfully.
> 
>  Eagerly waiting for the reply.
> 
>  Rgds,
>  s.suresh
> 
>  ________________________________
> 
>  Want to look great? Get expert opinion on beauty and skin care. Ask the
>  expert! <http://content.msn.co.in/Lifestyle/AskExpert/Default01.htm>
> 
> 
> 
>  ________________________________
> 
>  Palate Teasers: Straight from Master Chef! Sanjeev Kapoor
>  <http://content.msn.co.in/Lifestyle/Moreonlifestyle/LifestylePT_101106_1
>  530.htm>
>  --
>  U4EA Technologies
>  http://www.u4eatech.com
> 
>  -------------- next part --------------
>  An HTML attachment was scrubbed...
>  URL:
>  http://listserv.ActiveState.com/mailman/private/expect/attachments/20070808/d67c3e93/attac
hment.html
> 
>  ------------------------------
> 
>  Message: 2
>  Date: Thu, 9 Aug 2007 03:14:53 +0530
>  From: Suresh Sundararaman <suresh_serc@[...].com>
>  Subject: Re: [Expect] Error in Expect "spawn id exp5 not open"
>  To: Stephen Cattaneo <stephen.cattaneo@[...].com>,
>          <expect@[...].com>
>  Message-ID: <BAY124-W16F9D3C4E447E900F050D09DE70@[...].gbl>
>  Content-Type: text/plain; charset="iso-8859-1"
> 
> 
>  Hi Stephen & Rufus,
> 
>  I used the command "exp_internal 1" and "expect_out(buffer)" and could get
>  some output. But i am unable to visualize, where i am going wrong. If you
>  people can guide me thru this, it will be really great, as i am new to this
>  error.
> 
>  Rgds,
>  s.suresh
>  408-991-5518
> 
> 
>  Date: Wed, 8 Aug 2007 13:02:52 -0700From: Stephen.Cattaneo@u4eatech.comTo:
>  expect@listserv.activestate.comSubject: Re: [Expect] Error in Expect
>  "spawn id exp5 not open"
> 
> 
> 
> 
> 
> 
> 
> 
>  Try the script with exp_internal  on,  see if that gives you more info.
> 
>  -s
> 
> 
> 
> 
> 
>  From: Suresh Sundararaman [mailto:suresh_serc@[...].com] Sent:
>  Wednesday, August 08, 2007 12:57 PMTo: Stephen CattaneoSubject: RE: [Expect]
>  Error in Expect "spawn id exp5 not open"
> 
>  I still get the same error even though i inserted sleep as you told me.
> 
> 
> 
>  Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"Date: Wed, 8
>  Aug 2007 12:13:42 -0700From: Stephen.Cattaneo@u4eatech.comTo:
>  suresh_serc@[...].com
> 
>  This is common error with expect.  Trying inserting a few sleeps:
>  package require Expectspawn telnet 192.168.xx.xxexpect login:
>  sleep 2send "root\r"expect Password:
>  sleep 2send "admin123\r"expect #
>  sleep 2send "\r"expect #send "show run\r"expect #
> 
> 
> 
> 
> 
>  From: expect-bounces@[...].com [mailto:
>  expect-bounces@[...].com] On Behalf Of Suresh
>  SundararamanSent: Wednesday, August 08, 2007 12:12 PMTo:
>  jeffh@activestate.com; expect@listserv.activestate.comSubject: [Expect]
>  Error in Expect "spawn id exp5 not open"
> 
>  Jeff / Expect Gurus, I use Windows XP and run basic expect command in the
>  tclsh console of the activestate TCL version 8.4.15.0 and i get an error.Iuse expect to do
 a telnet to the gateway and send some commands to config
>  it. But i get an error as "spawn id exp5 not open" when the send command is
>  used. The script is here : package require Expectspawn telnet
>  192.168.xx.xxexpect login: send "root\r"expect Password: send
>  "admin123\r"expect #send "\r"expect #send "show run\r"expect # I get the
>  following error when i run the above file in tclsh console : % source
>  GW_connect.expchild process exited abnormally% send: spawn id exp5 not
>  open%% tclsh GW_connect.expsend: spawn id exp4 not open    while
>  executing"send "root\r""    (file "GW_connect.exp" line 4) I tried googling
>  but could not find any solution.Can anyone just let me know why this error
>  comes and how can i get out of it and can run the script successfully.
>  Eagerly waiting for the reply. Rgds,s.suresh
> 
> 
> 
>  Want to look great? Get expert opinion on beauty and skin care. Ask the
>  expert!
> 
> 
> 
> 
>  Palate Teasers: Straight from Master Chef! Sanjeev Kapoor -- U4EA
>  Technologieshttp://www.u4eatech.com
>  _________________________________________________________________
>  Sign in and get updated with all the action!
>  http://content.msn.co.in/Sports/FormulaOne/Default
>  -------------- next part --------------
>  An HTML attachment was scrubbed...
>  URL:
>  http://listserv.ActiveState.com/mailman/private/expect/attachments/20070809/f65aecba/attac
hment.html
> 
>  ------------------------------
> 
>  _______________________________________________
>  Expect mailing list
>  Expect@[...].com
>  http://listserv.ActiveState.com/mailman/listinfo/expect
> 
> 
>  End of Expect Digest, Vol 40, Issue 3
>  *************************************
> 



-- 
Don't worry about people stealing an idea. If it's original, you will have
to ram it down their throats.
  - Howard Aiken

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved