Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
can't read "expect_out(buffer)": no such variable

Posted by AndyS (AndyS), 6 December 2004
I encountered this error when running a script that had been running, but that I heavily modified.

I got is down to the following 4 lines:

#!/usr/local/bin/expect
puts "Enter 'hi', then ENTER"
expect "hi\n"
puts "buf: $expect_out(buffer)"

When I type in "hi\n", the 'puts' works OK
When I let it time out, I get this error:

can't read "expect_out(buffer)": no such variable
   while executing
"puts "buf: $expect_out(buffer)..."
   (file "trm22" line 4)

I can't see what's going on.
I'm running expect version  5.7.0 on a UNIX system.

Any help would be appreciated.

Thanks,
            Andy


Posted by admin (Graham Ellis), 6 December 2004
Hi, Andy .. I've NOT got my expect stuff with me but I'm wondering if you try typing in something before "hi" do you get that reported back?    What if you do an
   array names expect_out
... what do you see?

Posted by AndyS (AndyS), 6 December 2004
I added that line to make it look like this

#!/usr/local/bin/expect
puts "Enter 'hi', then ENTER"
expect "hi\n"
array names expect_out;
puts "buf: $expect_out(buffer)"


That gave me the following error:

Enter 'hi', then ENTER
anb hi def
"expect_out" isn't an array
   while executing
"array names expect_out"
   (file "/home/scharmer/expect/trm22" line 4)

It looks like I can't look at expect_out(...) at all.



Posted by admin (Graham Ellis), 6 December 2004
Hmm ... think you have your threads mixed??   I've posted a quick thought on the other active thread ...



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho