subprocess 'wait' method causes .py program to hang.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Earl Eiland

    #1

    subprocess 'wait' method causes .py program to hang.

    I calling a Windows executable with PROC = subprocess.Pope n('...'), and
    blocking further python execution until the process terminates with
    PROC.wait(). Occasionally, something unusual happens with the
    subprocess, and it fails without terminating the process. When this
    happens, my Python program doesn't detect the error condition, and
    hangs.

    What can I do about this?

    Earl Eiland

  • Dennis Lee Bieber

    #2
    Re: subprocess 'wait' method causes .py program to hang.

    On Sat, 19 Mar 2005 09:36:35 -0700, Earl Eiland <eee@nmt.edu> declaimed
    the following in comp.lang.pytho n:

    Isn't this the third time you've posted this question?
    [color=blue]
    > I calling a Windows executable with PROC = subprocess.Pope n('...'), and[/color]

    Forgive me, but is "subprocess.Pop en()" something new in 2.4? I
    can't find it in the modules available in 2.3.
    [color=blue]
    > blocking further python execution until the process terminates with
    > PROC.wait(). Occasionally, something unusual happens with the[/color]

    By definition, don't the various "Popen" things imply at least
    one pipe is created, for reading by default. But you seem not to have
    any pipes in this call (or aren't using them, as it seems you are
    getting back an object representing the entire subprocess state).
    Perhaps the failure mode is not the termination of the subprocess, but a
    state where it is waiting for a user response, which you do not provide.

    Your wait() logic, with no access of pipe streams (visible)
    seems similar to the use of

    os.spawnl*()

    followed by

    os.waitpid()


    --[color=blue]
    > =============== =============== =============== =============== == <
    > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
    > wulfraed@dm.net | Bestiaria Support Staff <
    > =============== =============== =============== =============== == <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

    Comment

    Working...