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


Groups > comp.lang.python > #18361

Re: Avoid race condition with Popen.send_signal

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <cameron@cskk.homeip.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'example:': 0.03; 'indeed,': 0.07; 'received:edu.au': 0.07; 'anyway': 0.09; 'exception': 0.12; 'darren': 0.16; 'e.errno': 0.16; 'errno': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'posix': 0.16; 'pythonic': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'cc:addr :python-list': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'maybe': 0.21; 'header:In-Reply-To:1': 0.22; 'precise': 0.23; 'cc:2**0': 0.24; 'import': 0.27; 'raise': 0.28; 'pass': 0.29; 'cc:addr:python.org': 0.29; 'error': 0.29; 'correct': 0.29; 'header:User-Agent:1': 0.33; 'probably': 0.34; 'symbol': 0.34; 'try:': 0.34; 'something': 0.35; 'received:au': 0.36; '...': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.37; 'but': 0.37; 'except': 0.37; 'think': 0.37; 'should': 0.39; 'else': 0.39; "it's": 0.40; 'more': 0.61; 'received:202': 0.66; 'cameron': 0.73; 'chek': 0.84; 'mandates': 0.84
Date Tue, 3 Jan 2012 12:44:58 +1100
From Cameron Simpson <cs@zip.com.au>
To Devin Jeanpierre <jeanpierreda@gmail.com>
Subject Re: Avoid race condition with Popen.send_signal
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <CABicbJKPmckzRwKa9BgTzP8p+nVO98eKh2s1=ZDjBSoY-N1OvQ@mail.gmail.com>
User-Agent Mutt/1.5.21 (2010-09-15)
References <CABicbJKPmckzRwKa9BgTzP8p+nVO98eKh2s1=ZDjBSoY-N1OvQ@mail.gmail.com>
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.4327.1325555666.27778.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325555666 news.xs4all.nl 6869 [2001:888:2000:d::a6]:57919
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18361

Show key headers only | View raw


On 02Jan2012 20:31, Devin Jeanpierre <jeanpierreda@gmail.com> wrote:
| > I think that catching the exception is probably the most Pythonic way.
| 
| It's the only correct way.

Indeed, but be precise - chek that it _is_ error 3, or more portably,
errno.ESRCH. POSIX probably mandates that that is a 3, but the symbol
should track the local system if it differs. Example:

  import errno
  ...
  try:
    ...signal...
  except OSError, e:
    if e.errno == errno.ESRCH:
      pass      # or maybe an info log message
    else:
      raise     # something else wrong - raise exception anyway

Cheers,
-- 
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

WHAT"S A ""K3WL D00D"" AND WH3R3 CAN 1 G3T S0M3!!!!!!!!!!!????????
        - Darren Embry

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


Thread

Re: Avoid race condition with Popen.send_signal Cameron Simpson <cs@zip.com.au> - 2012-01-03 12:44 +1100
  Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-02 19:16 -0800
    Re: Avoid race condition with Popen.send_signal Cameron Simpson <cs@zip.com.au> - 2012-01-03 15:53 +1100
      Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:52 -0800
    Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 09:44 +0100
      Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:12 -0800
        Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 16:09 +0100
          Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 09:58 -0800
            Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 19:45 +0100
    Re: Avoid race condition with Popen.send_signal Chris Angelico <rosuav@gmail.com> - 2012-01-03 19:58 +1100
      Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 06:20 -0800
    Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 10:38 +0100
      Re: Avoid race condition with Popen.send_signal Adam Skutt <askutt@gmail.com> - 2012-01-03 07:03 -0800
        Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 17:24 +0100
        Re: Avoid race condition with Popen.send_signal Jérôme <jerome@jolimont.fr> - 2012-01-03 18:25 +0100

csiph-web