Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does Expect works with Prowrap?

Status
Not open for further replies.

cptk

Technical User
Mar 18, 2003
305
US
Is anyone familiar with TclPro Prowrap and whether or not the expect extension works with Prowrap?

Using the "default" use option in Prowrap, tk scripts work fine. However, when I use the same "default" use option, which supposely handles Expect extensions, it gives an error "invalid spawn command" -- so Expect is not working correctly.
 
Clarification:

I meant Expectk
 
I seem to recall that when wrapping an Expect script with TclPro Wrapper, your script needs to do an explicit loading of the Expect package. It's simple enough, just execute the following before you try to access any Expect commands in your script:

Code:
package require Expect

This won't cause any problems when running the script with the expect or expectk, either. The [tt]package require[/tt] command will be silently ignored, as Expect is already implicitly loaded in those interpreters.

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Ken -

Thanks for the reply ... I was just getting to my Tclpro manual, searching for Expect, etc. You save me lots of research time!!

At first it didn't work, but after I modified my script to instead use Tclpro's version of wish (prowish83) and included the package require Expect cmd in my script, I WAS ABLE TO PROWRAP THE FILE !!! yippeee!!!

Now, this presented another curious question:
How come my other script files, which utilized a non-tclpro version of wish (i.e.#!/blah/blah/wish8.3), could then successfully be prowrapped? How come Tclpro doesn't complain about the "other" version of wish? (Note: these scripts I'm refering to are without any Expect code - they're just regular tcl/tk scripts).
 
Well, it depends on how you're wrapped them. It's been a while since I've played around with TclPro Wrapper, so let's see if I can remember this correctly...

TclPro Wrapper ignores any [tt]#![/tt] line starting your script. (Though in retrospect, it would have been a cool feature if somehow it could have used that to determine the appropriate interpreter to use, especially for custom interpreters.) If you don't tell it otherwise, Wrapper uses the "bigwish" interpreter -- which is the [tt]prowish83[/tt] interpreter you mentioned -- that has the various supported extensions statically linked to it. But it still requires you to include the appropriate package require lines in your script to gain access to those extensions.

You can tell Wrapper to use a different interpreter with the prowrap -uses option. Wrapper has built-in support for about half a dozen stock interpreter variations. You can also use a custom interpreter if you follow the steps listed in the documentation.

- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thanks again Ken ...

So that's it ! It ignores any #! at the start of your script. I don't recall seeing that in any Tclpro documentation. Just to prove that, I deleted the #! line at the start of my script, kept the package require Expect cmd and prowrap the script file and sure enough it works.

Thanks again ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top