Re: [Tutor] Replacing keyboard input to EXE file

2009-06-12 Thread Wayne
On Fri, Jun 12, 2009 at 2:49 AM, eShopping wrote: > > Hm .does this mean we are snookered on Win XP? Well, strictly using python anyway. I'm not sure precisely how the ctypes module works, but it's a fairly simple amount of code in assembly to push characters into the keyboard buffer. I pre

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-12 Thread Alan Gauld
"eShopping" wrote Or use the Python wrapper around expect - pyexpect??? Alan G Installed pexpect and rewrote the code to look like this: 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 p

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-12 Thread eShopping
"Tino Dai" 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 wrappe

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Tino Dai
On Thu, Jun 11, 2009 at 1:15 PM, Alan Gauld wrote: > > "Tino Dai" 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 subpr

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Alan Gauld
"Tino Dai" 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

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Tino Dai
Hi, 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/ -Tino On Thu, Jun 11, 2009 at 9:45 AM, eShopping w

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread eShopping
>> eShopping wrote: >>> import subprocess >>> x = subprocess.Popen(args="poly.exe",stdin=subprocess.PIPE) >>> for item in ["polyin.dat", "polyout.dat", "polyout.plt"]: >>> x.stdin.write('%s\n' % item) >>> but got the same error message >> >> Above code would seem to be correct. >> >> Are you

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread A.T.Hofkamp
eShopping wrote: At 13:26 11/06/2009, you wrote: Are you sure the Fortran program accepts the names? One easy way to test this is to try C:\> poly.exe < poly_files.txt in a CMD program (or COMMAND or whatever the console program is called nowadays at Win* systems). Tried piping the input as

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Alan Gauld
"eShopping" wrote C:\> poly.exe < poly_files.txt in a CMD program (or COMMAND or whatever the console program is called nowadays at Win* systems). Tried piping the input as suggested but POLY ignores the pipe and just asks me for the names of the files as if we were in interactive mode.

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Lie Ryan
eShopping wrote: > At 13:26 11/06/2009, you wrote: >> eShopping wrote: >>> import subprocess >>> x = subprocess.Popen(args="poly.exe",stdin=subprocess.PIPE) >>> for item in ["polyin.dat", "polyout.dat", "polyout.plt"]: >>> x.stdin.write('%s\n' % item) >>> but got the same error message >> >> Ab

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread eShopping
At 13:26 11/06/2009, you wrote: eShopping wrote: import subprocess x = subprocess.Popen(args="poly.exe",stdin=subprocess.PIPE) for item in ["polyin.dat", "polyout.dat", "polyout.plt"]: x.stdin.write('%s\n' % item) but got the same error message Above code would seem to be correct. Are you

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread A.T.Hofkamp
eShopping wrote: import subprocess x = subprocess.Popen(args="poly.exe",stdin=subprocess.PIPE) for item in ["polyin.dat", "polyout.dat", "polyout.plt"]: x.stdin.write('%s\n' % item) but got the same error message Above code would seem to be correct. Are you sure the Fortran program ac

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread eShopping
Hi I have a legacy (FORTRAN) program called POLY.EXE which asks the user interactively for three inputs (file names) from the keyboard. I would like to run this program in batch and tried to replace the interactive prompts with file names stored in a separate file using this Python script:

Re: [Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Wayne
On Thu, Jun 11, 2009 at 3:08 AM, Alun Griffiths < alun.griffi...@dsl.pipex.com> wrote: > Hi > > I have a legacy (FORTRAN) program called POLY.EXE which asks the user > interactively for three inputs (file names) from the keyboard. I would like > to run this program in batch and tried to replace t

[Tutor] Replacing keyboard input to EXE file

2009-06-11 Thread Alun Griffiths
Hi I have a legacy (FORTRAN) program called POLY.EXE which asks the user interactively for three inputs (file names) from the keyboard. I would like to run this program in batch and tried to replace the interactive prompts with file names stored in a separate file using this Python script: