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 Aaron P. Perez other posts by this author
Aug 10 2007 8:45AM 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"
I remember some horrible dream about the line in Suresh's output
"write(spawn_id=]: broken pipe". I had this problem once way back when I
was trying to see if we could upgrade our Tcl/Expect versions from
Expect for NT to the most current stable releases.

 

There were three things that I had to do to get mine to work, 2 of which
have already been mentioned.

1.	Replace dbghelp.dll to 6.6.7.5
2.	DEP cuases conflicts, edit c:\boot.ini: change /NoExecute =
<state>  to /NoExecute = AlwaysOff
3.	change call of programs from [spawn cmd] then [send "program"]
to [spawn "program"]

 

Have you done #2, Suresh?

 

________________________________

From: Perez, Aaron P. 
Sent: Thursday, August 09, 2007 12:32 PM
To: 'Suresh Sundararaman'; 'expect@listserv.activestate.com'
Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"

 

What does this yield?

 

package require Expect
spawn telnet

send "help\r"
expect "Welcome to Microsoft Telnet Client"

________________________________

From: Suresh Sundararaman [mailto:suresh_serc@[...].com] 
Sent: Thursday, August 09, 2007 12:27 PM
To: Perez, Aaron P.; 
Subject: 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.exp
send: sending "help\r" to { exp12 }
expect: does "" (spawn_id exp12) match glob pattern "login: "? no
expect: spawn id exp9 not open
write(spawn_id=]: broken pipe
expect: read eof
expect: set expect_out(spawn_id) "exp12"
expect: 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.exp
send: 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 -0500
From: Aaron.Perez@[...].com
To: 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 PM
To: 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 telnet
2196
% puts $spawn_id
exp7

I get the above things always.

________________________________

Subject: RE: [Expect] Error in Expect "spawn id exp5 not open"
Date: Thu, 9 Aug 2007 14:02:08 -0500
From: Aaron.Perez@[...].com
To: 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 AM
To: Perez, Aaron P.; expect@[...].com
Subject: RE: [Expect] Error in Expect "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 the following error:

expect: does "" (spawn_id exp5) match glob pattern "login: "? no
expect: read eof
expect: 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
where i used a different device and i face the same issue and error.
 
The version of the windows PC which i use is as follows:
System : Microsoft Windows XP Professional, Version 2002, Service 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 -0500
From: Aaron.Perez@[...].com
To: expect@[...].com
Subject: 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 running [spawn telnet] gives me M$'s
telnet. Are you getting the right telnet (I have ~4 different 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 AM
To: expect@[...].com
Subject: Re: [Expect] 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 something is wrong with your script.

I don't see any indication that another program was started. However,
notice that what you are 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 anything 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.exp
send: sending "i get <> " to { exp5 }
expect: does "" (spawn_id exp5) match glob pattern "login:"? no
expect: read eof
expect: set expect_out(spawn_id) "exp5"
expect: set expect_out(buffer) ""
exit out of expect
send: sending "root" to { exp5 send: spawn id exp5 not open%
%
 
Rgds,
s.suresh
408-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
<http://content.msn.co.in/Sports/FormulaOne/Default>  

 

________________________________

Catch the cricket action with MSN! Click here!
<http://content.msn.co.in/Sports/Cricket/Default.aspx>  

 

________________________________

Want to look great? Get expert opinion on beauty and skin care. Ask the
expert! <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
© 2004 ActiveState, a division of Sophos All rights reserved