[Tutor] Replacing keyboard input to EXE file

A.T.Hofkamp a.t.hofkamp at tue.nl
Thu Jun 11 15:08:11 CEST 2009


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 suggested but POLY ignores the pipe and 
> just asks me for the names of the files as if we were in interactive mode.

If the OS cannot convince the program to use stdin, than most certainly Python 
won't either (since the latter uses the former).

You need a different approach to convince poly to accept file-names in a 
non-interactive way.
At a Unix system, you'd step up to emulating a terminal. No idea whether that 
also works at a Win* system.
You could have a look at 'expect', a program to emulate interactive 
interaction with another program, or pexpect, the python brother of that program.

Albert



More information about the Tutor mailing list