Training, Open Source computer languages

This is page http://www.wellho.net/forum/The-Tcl- ... guage/Plain-old-TCL-Expect-for-Windows.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
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))
Plain old TCL/Expect for Windows

Posted by MarkTChristy (MarkTChristy), 28 February 2005
I have installed and used ActiveState's TCL. It's free - it works - that is nice  . The Expect package however is pricey. So, I am going to have to revert to the freeware version found at...
ftp://bmrc.berkeley.edu/pub/winnt/tcltk/expect/expect-snap29-setup.exe
... I uninstalled everything from ActiveState, and re-installed this snapshot. The web site says, "It comes with Tcl 8.0, Tk 8.0, and Expect 5.21". So I installed it only ...
Being free is nice, but I cannot for the life of me figure out why the same scripts that run under active state just fine, do not function here. Basically, the first hurdle seems to be this line in the script (which the FAQ says you must have for this verion)...
package require Expect
When tclsh80 encounters this line the error is...
can't find package Expect
   while executing
"package require Expect"
   (file "test.tcl" line 1)


I tried running the shell standalone... tclsh80... and get the '%' prompt. When I type the name of the script in the shell I get this error...
%test.tcl <hostname>
couldn't execute "C:\PROGRA~1\Expect-5.21\bin\test.tcl": no such file or directory

What is going on here? I have the path to the executables defined in my environment variables. Heck, I am even running that command from the directory where they live, yet "can't find" pops up. Where is it looking, what is it doing? Does it work.... help  

There has got to be a way to make this work, otherwise why would it exist? aaaargh.  

Posted by admin (Graham Ellis), 1 March 2005
I think that one of the reasons that ActiveState chose to "do" Expect for Windows and charge for it is that there isn't a reliable and up to date version out there that's available for free.  I've not got involved in Windows systems programming, but Expect on Windows probably ain't an easy thing to implement at all.  But I suspect you're not looking for a technical dissertation on that  

I wonder if your uninstall was truely complete, or if system variables and settings got left in various environment variables set up by the install wizzard.  Or if you need to add settings to your environment variables ...

Have a look at your

TCLLIBPATH which should contain a Tcl list of directories to search when autoloading Tcl commands.

and you may find your error there. Other Environment variables that effect Tcl are TCL_LIBRARY which is the location of the directory containing library scripts and HOME and PATH used to determine the current directory and the path to executable programs respectively.

Posted by MarkTChristy (MarkTChristy), 1 March 2005
on 03/01/05 at 06:06:43, Graham Ellis wrote:
TCLLIBPATH which should contain a Tcl list of directories to search when autoloading Tcl commands.
Other Environment variables that effect Tcl are TCL_LIBRARY which is the location of the directory containing library scripts and HOME and PATH used to determine the current directory and the path to executable programs respectively.


First off I discovered that those variables did not exist in my system environment variables, so I created them...

I set the variable TCLLIBPATH to (listed for ease of reading)...
c:\progra~1\expect-5.21\lib
c:\progra~1\expect-5.21\lib\expect-5.21
c:\progra~1\expect-5.21\lib\blt8.0
c:\progra~1\expect-5.21\lib\dde1.1

I created TCL_LIBRARY with the same settings...

What is HOME variable? W2K has HOMEDIR and HOMEPATH. Those are loaded with the values of 'My Documents' location and C: respectively.

I have also loaded PATH with every possible directory that the install uses... which should take care of that.

With that ammo loaded, I tried again to run the script. While doing so I found that if I ran the shell as ...
C:\PROGRA~1\Expect-5.21\bin> tclsh80
%

Then typed the command ...
% package require expect
5.21

It seemed to know how to load the package, responding with '5.21'  
Testing that I typed...
% package version expect
5.21

Seems to be loaded at the shell...

Hoping now that I could run the simple script, I removed the 'package require' commands from the script and tried it...
% test.tcl <host>
and
% ./test.tcl <host>

The end result is the same and looks like this...
% test.tcl host
couldn't execute "C:\PROGRA~1\Expect-5.21\bin\test.tcl": no such file or directory
% ./test.tcl host
couldn't execute ".\test.tcl": no such file or directory
%

An interesting note here is before all that I just tried to run the script from the DOS command line by invoking tclsh80 with arguments... that looks like...
C:\PROGRA~1\Expect-5.21\bin>tclsh80 test.tcl ax8a
ax8a
invalid command name "spawn"
   while executing
"spawn ping -n 1 -w 1000 $item"

...which is quite different and almost means that expect was working... sort of.

Still confounded and bemused...  

Posted by admin (Graham Ellis), 2 March 2005
Quote:
Hoping now that I could run the simple script, I removed the 'package require' commands from the script and tried it...
% test.tcl <host>
and
% ./test.tcl <host>
 
The end result is the same and looks like this...
% test.tcl host
couldn't execute "C:\PROGRA~1\Expect-5.21\bin\test.tcl": no such file or directory
% ./test.tcl host
couldn't execute ".\test.tcl": no such file or directory
%


I think here you were loading a second copy of Tcl ... having required expect in the first. So at least it explains that particlular problem.

Mark - is there any clue in the documentation that comes with this old version of Expect, and / or any contact points or FAQs that relate to it specifically?  As per my earlier comment, ActiveState have done a (paid) Expect because there is a need for it - so you are likely to find that what you save in licensing fees you spend on hassles and support issues with this one.

Posted by MarkTChristy (MarkTChristy), 18 March 2005
on 03/02/05 at 06:21:34, Graham Ellis wrote:
Mark - is there any clue in the documentation that comes with this old version of Expect, and / or any contact points or FAQs that relate to it specifically?  As per my earlier comment, ActiveState have done a (paid) Expect because there is a need for it - so you are likely to find that what you save in licensing fees you spend on hassles and support issues with this one.


I've been gone for a while   -  I thought I'd close up this thread somewhat. I remember way-back (in tech time)   , when I used expect for windows and it worked. But I was using Windows98, or maybe 98me  . But I am sure it used to work just as easy as install it and use it.

Maybe Windows2K+ or my particular install of it is just breaking it somehow  . I have W2K at home but haven't tried it there. I'll do that real soon now  

I'd love to buy the real version and have it at work for menial tasks I do everyday, but my employer doesn't think that is a valid request  . Granted I don't do much with it - but I could think up stuff . I also can't justify the price   ActiveState wants for it just to tinker around with at home.

I looked long and far to find other groups or expertise in the free version that I cannot get to work. This forum is one of the few I could find. If anyone knows of any newsgroups or alt.free.expect.is.broken user or news groups pass them onto me, please!

Thanks, and I'll stop whimpering now...  

Posted by admin (Graham Ellis), 19 March 2005
Thanks for the follow up, Mark.

I think the term "it's a bummer" comes to mind ... WIBNIF (Wouldn't it be nice if) open source Expect implemented for current Windows and Tcl was available.  Alas, I thing that ActiveState are the only ones whoo have dealt with the technical issues involved in doing the implementation, and they're charging; something we need to live with or seek an alternative, and the alternative of using an older version or evaluation version is only a short (or medium at best) term solution.

I do recall being part of a small group chatting with Larry Wall (author / father of Perl) way back in 2000 when it had just gone to ActiveState for the Windows implementation.  He was very re-assuring about licensing in that Perl must / will remain free and how he had taken appropriate legal advise.  "The implementation is good for Perl. It may not be quite so good for Linux, but my first committment has to be to Perl" was his comment (and 5 years later, I may have a few words incorrect there).  I don't know what's happened / what the difference is with Expect - but I do know that the Perl licensing system is different to the others.

We're running a parallel thread here with another on the same topic ... I'm going to suggest most follow ups to that one please.

Posted by admin (Graham Ellis), 4 September 2005
Pulling this OLD post to the top of the stack.   I was downloading ActiveTcl last night and note that the Windows distribution now INLCUDES Expect - with "no license required".   I think we might have got what I said "wouldn't it be nice if ...." to!

Posted by admin (Graham Ellis), 10 September 2005
Yes, I've tried our Expect on Windows and it looks good. Sample, tested program at http://www.wellho.net/resources/ex.php4?item=t211/plet.exp.



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.

© 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