Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29506

Re: subprocess call is not waiting.

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'exit': 0.07; 'finished,': 0.07; 'python': 0.09; 'anymore.': 0.09; 'observation': 0.09; 'threads.': 0.09; 'cc:addr:python-list': 0.10; 'anyway': 0.11; 'subject:not': 0.11; 'thread': 0.11; 'end-of-file': 0.16; 'it..': 0.16; 'processes.': 0.16; 'subprocess': 0.16; 'differ': 0.17; 'written': 0.20; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'external': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'leave': 0.26; 'instead.': 0.27; 'message- id:@mail.gmail.com': 0.27; 'options': 0.27; 'correct': 0.28; 'run': 0.28; 'things,': 0.29; 'probably': 0.29; "i'm": 0.29; 'problem.': 0.32; 'launch': 0.32; 'could': 0.32; 'monitor': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; "i'll": 0.36; 'should': 0.36; 'possible': 0.37; 'two': 0.37; 'quite': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'shows': 0.38; 'page': 0.38; 'header:Received:5': 0.40; 'your': 0.60; 'most': 0.61; "you'll": 0.62; 'between': 0.63; 'show': 0.63; 'else.': 0.65; 'sounds': 0.71; '(they': 0.84; 'reap': 0.84; 'anywhere,': 0.93; 'processes,': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KvJx3k7Woz515jdZTjgn0suImYz2bPXU2hJ6TGLZdDY=; b=koYFR+KWtRBxEDjDCgdOHxnyb1roOTYJMs1RHTp/gcy6FwuEZapyq+ZYRaKSs2/NAZ YJyioAJjRpsUXXZciaKHvOj1le2VcgnBrTtS8PwMOR8mBMFVY6IGj5xZYKlSOJOiseHE Loh6aSAH/5Gd9idVIl15R4bZmInnBHC1AhEvtpboXh5ELebiC5Ozcs2eJoLEJogXU+oh GdvQQkStuHA51crMe3esPaSRGYuIV7FcFqy59p9YMO5g0+yw0bC7lLuxxG/gOP4ucIDX K1B9NRNKT33+78GLotc5VHgBUY+OIXTe2pBAjJ/jUDG4j2EZkVFu7pYOHJpNRFSYBH+L zchQ==
MIME-Version 1.0
In-Reply-To <5059c765$0$6952$e4fe514c@news2.news.xs4all.nl>
References <d49e1e71-afe2-4aab-8c67-3e2eea6533a6@googlegroups.com> <0b598d7f-7137-47cc-8eed-80ab450536c5@googlegroups.com> <mailman.734.1347681745.27098.python-list@python.org> <0405db16-6a4c-4189-a32c-2311d45eead3@googlegroups.com> <CAF_E5JabYOargjeDa9BdMZnUq3SmbXCO4Uue6NnSESUfHJspvA@mail.gmail.com> <28ih585cvob222k24v7ccfapgvav7nfgur@invalid.netcom.com> <mailman.906.1348050393.27098.python-list@python.org> <5059c765$0$6952$e4fe514c@news2.news.xs4all.nl>
Date Wed, 19 Sep 2012 17:34:58 +0100
Subject Re: subprocess call is not waiting.
From andrea crotti <andrea.crotti.0@gmail.com>
To Hans Mulder <hansmu@xs4all.nl>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.925.1348072500.27098.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348072500 news.xs4all.nl 6922 [2001:888:2000:d::a6]:32964
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29506

Show key headers only | View raw


2012/9/19 Hans Mulder <hansmu@xs4all.nl>:
> Yes: using "top" is an observation problem.
>
> "Top", as the name suggests, shows only the most active processes.

Sure but "ls -lR /" is a very active process if you try to run it..
Anyway as written below I don't need this anymore.

>
> It's quite possible that your 'ls' process is not active, because
> it's waiting for your Python process to read some data from the pipe.
>
> Try using "ps" instead.  Look in thte man page for the correct
> options (they differ between platforms).  The default options do
> not show all processes, so they may not show the process you're
> looking for.
>
>> Anyway I also need to know when the process is over while waiting, so
>> probably a thread is the only way..
>
> This sounds confused.
>
> You don't need threads.  When 'ls' finishes, you'll read end-of-file
> on the proc.stdout pipe.  You should then call proc.wait() to reap
> its exit status (if you don't, you'll leave a zombie process).
> Since the process has already finished, the proc.wait() call will
> not actually do any waiting.
>
>
> Hope this helps,
>


Well there is a process which has to do two things, monitor
periodically some external conditions (filesystem / db), and launch a
process that can take very long time.

So I can't put a wait anywhere, or I'll stop everything else.  But at
the same time I need to know when the process is finished, which I
could do but without a wait might get hacky.

So I'm quite sure I just need to run the subprocess in a subthread
unless I'm missing something obvious..

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

subprocess call is not waiting. paulstaten@gmail.com - 2012-09-13 08:17 -0700
  Re: subprocess call is not waiting. MRAB <python@mrabarnett.plus.com> - 2012-09-13 16:35 +0100
  Re: subprocess call is not waiting. woooee@gmail.com - 2012-09-13 10:24 -0700
    Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-14 10:52 +0200
  Re: subprocess call is not waiting. Chris Rebert <clp2@rebertia.com> - 2012-09-13 22:27 -0700
  Re: subprocess call is not waiting. paulstaten@gmail.com - 2012-09-14 05:22 -0700
    Re: subprocess call is not waiting. Wanderer <wanderer@dialup4less.com> - 2012-09-14 10:38 -0700
    Re: subprocess call is not waiting. Chris Rebert <clp2@rebertia.com> - 2012-09-14 21:02 -0700
      Re: subprocess call is not waiting. paulstaten@gmail.com - 2012-09-15 05:59 -0700
        Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-18 14:54 +0100
        Re: subprocess call is not waiting. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-18 15:20 -0400
        Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-19 11:26 +0100
          Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 15:23 +0200
            Re: subprocess call is not waiting. Gene Heskett <gheskett@wdtv.com> - 2012-09-19 11:57 -0400
            Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-19 17:34 +0100
              Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 19:31 +0200

csiph-web