FAQ
popen3(cmd[, mode[, bufsize]]) Executes cmd as a sub-process. Returns the
file objects (child_stdin, child_stdout, child_stderr). Availability: Unix,
Windows. New in version 2.0.


I may be having a moment of brain fade, but I can't see how I get hold of
child_stdin etc, having started up a DOS program with popen3

Help?
--
A

Search Discussions

  • Zac Jensen at Jun 15, 2003 at 9:50 pm

    On Sunday 15 June 2003 03:32 pm, ddoc wrote:
    popen3(cmd[, mode[, bufsize]]) Executes cmd as a sub-process. Returns the
    file objects (child_stdin, child_stdout, child_stderr). Availability: Unix,
    Windows. New in version 2.0.


    I may be having a moment of brain fade, but I can't see how I get hold of
    child_stdin etc, having started up a DOS program with popen3

    Help?
    c_stdin, c_stdout, c_stderr = popen3("C:\command.com")

    c_stdout.write("dir\nexit\n")

    print c_stdin.read()


    ...

    not tested

    ...

    or ... something... have fun, hth

    - -Zac
  • Peter Hansen at Jun 15, 2003 at 10:05 pm

    ddoc wrote:
    popen3(cmd[, mode[, bufsize]]) Executes cmd as a sub-process. Returns the
    file objects (child_stdin, child_stdout, child_stderr). Availability: Unix,
    Windows. New in version 2.0.

    I may be having a moment of brain fade, but I can't see how I get hold of
    child_stdin etc, having started up a DOS program with popen3
    If you mean you don't understand what the docs are telling you, then
    this example based on the above text might help:

    childStdin, childStdout, childStderr = popen3(cmd, mode, bufsize)

    The return value is expressed as a tuple of three elements....

    -Peter
  • Ddoc at Jun 17, 2003 at 12:12 pm
    It was brainfade.
    The function returns a tuple, of course.
    It works, and solves one Linux task I had been contemplating for a while,
    but doesn't of itself accomplish a job I want to do in Windows

    I should be able to automate a DOS program - or rather seize its interface
    and control what goes in as from a keyboard, and catch what comes out as if
    to the screen, thus programattically determining what gets typed to it and
    what gets shown to a notional user, but I suspect I need to use pipes
    rather than the popen setup.

    Does anyone know an example of this being done (to a DOS/console program)
    that is available for inspection?



    --
    A

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJun 15, '03 at 9:32p
activeJun 17, '03 at 12:12p
posts4
users3
websitepython.org

3 users in discussion

Ddoc: 2 posts Peter Hansen: 1 post Zac Jensen: 1 post

People

Translate

site design / logo © 2022 Grokbase