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] Error in Expect "spawn id exp5 not open"
by Suresh Sundararaman other posts by this author
Aug 9 2007 12:27PM messages near this date
view in the new Beta List Site
Re: [Expect] Error in Expect "spawn id exp5 not open" | Re: [Expect] Error in Expect "spawn id exp5 not open"
If i use the script :
 
package require Expect
spawn telnet 192.168.x.x
send "help\r"
set timeout 120
expect "login: "
after 10000
send "root\r"
expect "Password: "
after 10000
send "admin123\r"
I get the following error:
 
% source test.expsend: sending "help\r" to { exp12 }
expect: does "" (spawn_id exp12) match glob pattern "login: "? noexpect: spawn id exp9 not o
penwrite(spawn_id=]: broken pipeexpect: read eofexpect: set expect_out(spawn_id) "exp12"expe
ct: set expect_out(buffer) ""send: sending "root\r" to { exp12 send: spawn id exp12 not open
%
 
if i use the script :
 
package require Expect
spawn telnet 192.168.x.x
send "help\r"
set timeout 120
 
I get the following error:
 
% source test.expsend: sending "help\r" to { exp13 }120%
What can be done to nail this issue more ?


Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"Date: Thu, 9 Aug 2007 14:11:35
 -0500From: Aaron.Perez@hospira.comTo: suresh_serc@hotmail.com; expect@[...].com






Can you then [send �help\r�] or any other command that should complete quickly in telnet
 without it complaining?
 




From: Suresh Sundararaman [mailto:suresh_serc@[...].com] Sent: Thursday, August 09, 2007 12:
09 PMTo: Perez, Aaron P.Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"
 
I executed the one which u said and got this result.% spawn telnet2196% puts $spawn_idexp7I 
get the above things always.



Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"Date: Thu, 9 Aug 2007 14:02:08
 -0500From: Aaron.Perez@hospira.comTo: suresh_serc@[...].com

What I meant by [spawn telnet] from the tchsh I meant not via a script.
Open up tclsh and type: spawn telnet
 
You should get back the windows PID as well as be able to [puts $spawn_id]
 




From: Suresh Sundararaman [mailto:suresh_serc@[...].com] Sent: Thursday, August 09, 2007 11:
58 AMTo: Perez, Aaron P.; expect@listserv.activestate.comSubject: RE: [Expect] Error in Expe
ct "spawn id exp5 not open"
 
Aaron / All, When i run "telnet" from the command prompt and "telnet" from the tcl prompt, i
 get MS's telnet.Now from the tcl prompt when i use "spawn telnet 192.168.x.x" i get error t
he following error:expect: does "" (spawn_id exp5) match glob pattern "login: "? noexpect: r
ead eofexpect: set expect_out(spawn_id) "exp5"I really feel that the spawn command itself is
 not working in my windows environment. Can anyone tell me what i need to do to make it work
 in my windows pc.  I even tried using spawn ping 192.168.x.y and spawn telnet 192.168.x.y w
here i used a different device and i face the same issue and error. The version of the windo
ws PC which i use is as follows:System : Microsoft Windows XP Professional, Version 2002, Se
rvice Pack 2 If anyone can help me out in solving this error, i will be very very happy, as 
it is giving me a real hard and tough time. I am using the new "dbghelp.dll" file of version
 6.6.7.5. Expecting a solution. Rgds,s.suresh



Date: Thu, 9 Aug 2007 13:08:38 -0500From: Aaron.Perez@hospira.comTo: expect@listserv.actives
tate.comSubject: Re: [Expect] Error in Expect "spawn id exp5 not open"

One more thing, does this work manually?
 
Can you go to the same directory that tclsh is running out of and run telnet from a command 
prompt? Can you [spawn] it manually from in tclsh?
 
From a command prompt if I run telnet I get M$�s telnet but if I [spawn telnet] I get the 
one from C:\Program Files\Expect-5.21\bin. Renaming the one from Expect-5.21 for NT and runn
ing [spawn telnet] gives me M$�s telnet. Are you getting the right telnet (I have ~4 diffe
rent ones on my system)?
 
Try running something like:
set telnetExe c:/windows/system32/telnet.exe
 
if {[file exists $telnetExe]} {
   spawn $telnetExe 192.168.xx.xx
   expect login:
   # etc ...
} else{
   # error condition
}
 
--Aaron




From: expect-bounces@[...].com [mailto:expect-bounces@[...].com] On Behalf Of Virden, Larry 
W.Sent: Thursday, August 09, 2007 4:05 AMTo: expect@listserv.activestate.comSubject: Re: [Ex
pect] Error in Expect "spawn id exp5 not open"
 

Hmm - either this isn't all the output, or not all the actions are being reported, or someth
ing is wrong with your script.

I don't see any indication that another program was started. However, notice that what you a
re told in the send line is that you are sending the string

 

i get <> 

 

off to an expect handle. What you get in response is nothing. The null response ("") doesn't
 match your login, your script then reads the End of file (eof), and

nothing else is going.

 

So, either the telnet isn't found, or isn't starting. Because the expect is not finding anyt
hing for you to work against.

 

 



From: Suresh Sundararaman
 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. Here is the error which i get if i run with
 the above commands. %% source GW_connect.expsend: sending "i get <> " to { exp5 }expect: doe
s "" (spawn_id exp5) match glob pattern "login:"? noexpect: read eofexpect: set expect_out(s
pawn_id) "exp5"expect: set expect_out(buffer) ""exit out of expectsend: sending "root" to { 
exp5 send: spawn id exp5 not open%% Rgds,s.suresh408-991-5518

 


 

-- 
<URL: http://wiki.tcl.tk/ > 
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: mailto:lvirden@[...].com >  <URL: http://www.purl.org/NET/lvirden/ >
 

 
 
 



Sign in and get updated with all the action! Formula One
 



Catch the cricket action with MSN! Click here!
_________________________________________________________________
Want to look great? Get expert opinion on beauty and skin care.
http://content.msn.co.in/Lifestyle/AskExpert/Default01.htm
Thread:
Suresh Sundararaman
Stephen Cattaneo
Suresh Sundararaman
Suresh Sundararaman
Aaron P. Perez
Aaron P. Perez
Suresh Sundararaman
Aaron P. Perez
Suresh Sundararaman
Aaron P. Perez
Suresh Sundararaman
Larry W. Virden
Suresh Sundararaman
Larry W. Virden
Suresh Sundararaman
Larry W. Virden
Aaron P. Perez
Suresh Sundararaman
Rufus Smith

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved