"Tino Dai" <obe...@gmail.com> wrote
>
>    I know that this is a python group but you might want to try the open
> source utility called Expect. It does what you need it to do without
> having
> having to go through this trial and error process with subprocess.
> http://expect.nist.gov/

Or use the Python wrapper around expect - pyexpect???

Alan G

Installed pexpect and rewrote the code to look like this:

import pexpect

x = pexpect.spawn("poly.exe")
for item in ["polyin.dat", "polyout.dat", "polyout.plt"]:
    x.sendline('%s\n' % item)

Now I get these errors:

Traceback (most recent call last):
File "C:\Projects\Active\Alun\US_DOE_EOR\test_poly.py", line 1, in -toplevel-
    import pexpect
  File "C:\Python24\Lib\site-packages\pexpect.py", line 82, in -toplevel-
    raise ImportError (str(e) + """
ImportError: No module named resource

A critical module was not found. Probably this operating system does not
support it. Pexpect is intended for UNIX-like operating systems.

Hm .....does this mean we are snookered on Win XP?

Best regards

Alun Griffiths





_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to