Subprocess and 16-bit FORTRAN
Nick Craig-Wood
nick at craig-wood.com
Sun Nov 25 16:30:05 EST 2007
Federico Ceccatto <z.darkmere at gmail.com> wrote:
> This is the kind of 'bugs' i've run into, perhaps someone could shed
> some light onto them?
>
> - Sometimes execution of child process (in this case, NTVDM.exe and
> its children) stops and the object is destroyed for no reason
> whatsoever. Very silent, no errors.
>
> - Sometimes '\x03' as input is ignored, working simply as a '\n' of
> sorts, while most of the time it simply kills the program as expected.
>
> - Sometimes specific points in the code where the user is asked for
> input and execution should be temporarily halted are ignored, as if
> somehow it got a newline character.
>
> None of these bugs are reproducible by running the same child
> processess via NTVDM.exe through say, cmd.exe and such.
>
> This has been driving me nuts for the last three weeks...
It sounds like you want an interactive channel to your process -
unfortunately subprocess doesn't really work when a conversation is
expected between your process and the subprocess - there is too much
buffering involved.
On unix you'd use the python expect module to work around these
problems. Unfortunately there isn't a windows version :-(
You could try the non blocking subprocess modification here
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
You could also try wx.Process and wx.Execute from wxPython.
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list