ActiveState Powered by ActiveState

ActiveState Community


Where is Expect?

Posted by kevinw on 2006-07-12 15:33
OS: All / Any | Product: ActiveTcl | tags: activetcl expect package
Question:

Where is Expect? Older versions of ActiveTcl had an expect executable, but the new versions don't. Where did it go? Why doesn't ActiveTcl 8.5 seem to have Expect anywhere?

Answer:

Rather than being linked to a different interpreter, in recent versions of ActiveTcl 8.4, Expect has been made into a proper Tcl package. If you have the line:

package require Expect

In your source file before the first use of any Expect functions or variables, you can then run the file using tclsh, without having to use a special interpreter.
------------------------------------------

With ActiveTcl 8.5.x there is an additional issue. Tcl 8.5 still has not been deemed the standard version, so the number of extensions shipped with 8.5 is limited. Modules can be downloaded and installed for ActiveTcl 8.5 through the TEApot distribution mechanism.

Being "developmental" has one major benefit, especially important if you cannot get internet access for TEApot. It is possible to install an 8.5 release ON TOP of (into the same directory) an 8.4 release. This gives you both tclsh and tclsh8.5, wish and wish8.5, fully working demos, plus the complete set of modules shipped with 8.4 which are also all compatible with 8.5.

If you wish to have both 8.4 and 8.5:
-You MUST install 8.4 first. (If you already have 8.5 only, it should be uninstalled.)
-It is always advisable to manually delete any files left behind in the ActiveTcl install directory when changing versions.
-You MUST use a compatible pairing. The compatible pairings are:

ActiveTcl 8.4.19.0 with 8.5.2.0
ActiveTcl 8.4.18.0 with 8.5.1.0
ActiveTcl 8.4.17.0 with 8.5.0.0.283511

santhosh_kumar_d | Fri, 2008-01-04 07:01

I installed the ActiveState Tcl-8.5 in my Windows machine but could not find the Expect package anywhere. I tried giving 'package require Expect' but it gives error --> "can't find package Expect". Please tell me as to where to fetch it up from. Thanks!

astillman | Fri, 2008-01-04 08:54

I also can not find Expect in my ActiveState Tcl-8.5 distribution for Linux.
"package require Expect" returns the same error.

santhosh_kumar_d | Mon, 2008-01-07 04:10

The current ActiveTcl 8.5.0 comes with fewer default installed packages, and
you would use the "teacup" to obtain new ones. At the DOS prompt, try:

teacup install Expect

More info on the teacup is in the docs.

mikeehamm | Tue, 2008-01-08 13:45

I Installed Tcl Version 8.5 on my Windows XP PC but when I included the line, "package require Expect" into my code, an error message pops up saying "Cant find package Expect"? I uninstalled Version 8.5 and reinstalled Version 8.4.14 and the Expect package gets installed. Is there something I missed, is the Expect extension included in Version 8.5? I would like to use Version 8.5, but since I need Expect, I will have to continue to use an older version. I also tried the "teacup install Expect" as instructed in the last post, without success.

deniseshoup | Tue, 2008-01-08 14:09

I installed 8.5, and tried the "teacup install Expect", with the following result:

C:\Tcl\bin>teacup install Expect
INTERNAL ERROR ______________________
INTERNAL ERROR Shell "c:\tcl\bin\tclsh.exe" does not exist
INTERNAL ERROR while executing
INTERNAL ERROR "CHECK $shell"
INTERNAL ERROR (procedure "platform::shell::platform" line 4)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::client::Snit_methodDoResolve" line
1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::client::Snit_methodResolveEntity" l
ine 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::client::Snit_methodinstallEntity" l
ine 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR (procedure "::repository::capp::Snit_methodinstall" line 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "::capp1 install Expect"
INTERNAL ERROR ("eval" body line 1)
INTERNAL ERROR invoked from within
INTERNAL ERROR "# Compiled -- no source code available
INTERNAL ERROR error "called a copy of a compiled script""
INTERNAL ERROR ______________________

C:\Tcl\bin>

grahams | Tue, 2008-02-12 15:26

Under ActiveTcl 8.5.0, when teacup reports that it can't find tclsh, you can usually work around the problem by starting tclsh85 and then running teacup from inside it.
c:>\tclsh85
%teacup install Expect

grahams | Tue, 2008-02-12 15:29

If teacup reports 404 errors when installing Expect, or any other extension, it usually means that the ActiveState Teapot repository is offline for updating. This can happen any time between 4 AM and 11 AM Pacific Time. If it happens, try again in a few minutes. Generally, updates take no longer than half an hour.

mikeehamm | Tue, 2008-02-12 15:42

There should be a better way to achieve the usage of Expect with the latest release of Tcl, similar to the older versions. The issue is when trying to do a "package require Expect" from within a Tcl/Tk program in order to utilize the Expect commands, at least for my needs. If it works for the older releases, there should be an upward similarity with the newer release.

deniseshoup | Wed, 2008-02-13 09:16

I tried about a dozen times yesterday, and again this morning, and I'm still getting the 404 error. I am able to get to teapot.activestate.com via browser, and I downloaded the .zip file containing expect.tcl, expect543.dll, injector.dll, pkgIndex.tcl, and teapot.txt - can someone tell me how to install these?

jomahony | Thu, 2008-06-05 07:46

I have installed Tcl 8.5 and am having the same problems described here activating expect. It appears that to use teacup the server needs to have access to the internet. Is that correct?
If so how do I activate the expect package if the computer I wish to do this on does not have access to the internet?

grahams | Tue, 2008-06-24 10:03

The FAQ has been updated to clarify the issue around Expect on ActiveTcl 8.5.

-->