pexpect and OpenVMS

Adrian Casey news at outbacklinux.com
Thu May 20 08:06:06 EDT 2004


I have a collection of tcl expect scripts which I am converting to python
using the excellent pexpect module (http://pexpect.sourceforge.net/).  So
far I've had great success in getting all my scripts to work with various
flavours of UNIX.  However, OpenVMS is causing me problems.

The tcl scripts work perfectly across UNIX and VMS.  I'm converting them
from tcl to python simply because python is more scalable and allows for
better code reuse.  And it's a nicer language to code in IMHO.

When running a pexpect script against a VMS system, the script only sends
the first character of the command and then gets a timeout.  For example,
if I do "sendline('sho proc')" and then drop to interactive mode, only the
's' from 'sho' has been sent to the 'shell' prompt.  Running a session in
'interactive' mode seems to work fine.

By experimenting with an interactive python session, I have determined that
VMS systems appear to use a different os.linesep - '\r' instead of '\n' for
UNIX.  So, I modified my script to set os.linesep = '\r' for VMS systems
but I still get lots of timeouts.  

The login files to the VMS systems tend to display a lot of information,
sometimes in colour meaning lots of escape characters are sent to the
terminal.  I'm wondering if this is confusing pexpect?  However, the tcl
scripts were not bothered by this at all.

One workaround I'm using at the moment is to send a series of 10 or 20
return charcters seperated by a 1 second sleep.  This generally works but
makes dealing with VMS systems very slow...  Under tcl, there is a way to
slow down the rate at which characters are sent to the client.  Is the same
available in pexpect?

Any ideas on how to make pexpect work with VMS systems?

Regards.
Adrian Casey.



More information about the Python-list mailing list