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
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Expect error

Posted by CS (CS), 27 June 2005
I am having a problem in a expect scripts. The script essentially spawns a ftp process and uses it to transfer files.  
The env details are:
OS: windows 2003 enterprise edition, version 5.2, sp1, v1
ActiveTcl : 8.4.6.1
Expect4Win: 1.0

I have been able to run the scripts from another Server which has same configuration.

The output shows :
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>expect: does "" (spawn_id exp4) match glob pattern "ftp>"? no
> expect: read eof
> expect: set expect_out(spawn_id) "exp4"
> expect: set expect_out(buffer) ""


Thanks for the help






Posted by admin (Graham Ellis), 27 June 2005
Is it the same FTP client that you're using on the two machines?

Hard to give much of an answer without seening any source code ...

Posted by CS (CS), 28 June 2005
Please find below the source code :

---------------------
package require Expect

exp_internal 1
set exp::winnt_debug 1

set timeout 10;

spawn ftp -i;

##Put hostname or ip string here
set host 192.168.8.35;
set username hpbi;
set password hpbi123;

expect "ftp>"
exp_send "open $host\r"

expect {
  timeout
  {      
     puts "script has timed out looking for User";
  }
  "User "
   {
      exp_send "$username\r"
    }
}

expect {

timeout {
 puts "script has timed out looking for Password";
}

"Password" {
 exp_send "$password\r"
 puts "\nFound Password string";
}

}

expect {
     timeout {
        puts "Failed to validate account on remote site : Timed out.";
     }
     "421 Service not available" {
        puts "Failed to validate account on remote site : Service not available.";
     }
     "530 Login incorrect" {
        puts "Failed to validate account on remote site: Login incorrect.";
     }
     "530 User $username cannot log in" {
        puts "Failed to validate account on remote site : Login incorrect.";
     }
     "230 User $username logged in" {
        set outcome 1;
        puts "Validated account  on remote site ";
     }
}

puts "finito";
------------------

Posted by admin (Graham Ellis), 28 June 2005
Does the FTP work manually on the machine that's causing the problem?  Is the FTP client in the path?

Posted by CS (CS), 28 June 2005
Yes the FTP is working fine manually.



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., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho