[Tutor] Replacing keyboard input to EXE file
eShopping
etrade.griffiths at dsl.pipex.com
Fri Jun 12 09:49:05 CEST 2009
>
>"Tino Dai" <oberoc at 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
More information about the Tutor
mailing list