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


Groups > comp.lang.python > #29506

Re: subprocess call is not waiting.

References (3 earlier) <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 2012-09-19 17:34 +0100
Subject Re: subprocess call is not waiting.
From andrea crotti <andrea.crotti.0@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.925.1348072500.27098.python-list@python.org> (permalink)

Show all headers | 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