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


Groups > comp.lang.python > #40458

Re: Different behavior with multiprocessing

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'exit': 0.07; 'problem:': 0.07; 'modulo': 0.09; 'subject:skip:m 10': 0.09; 'unsigned': 0.09; '255': 0.16; 'char,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:Different': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'code.': 0.20; 'this:': 0.23; 'seems': 0.23; 'second': 0.24; 'linux': 0.24; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'probably': 0.29; 'error': 0.30; 'code': 0.31; 'gets': 0.32; 'url:python': 0.32; 'values.': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'whatever': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'subject:with': 0.36; 'uses': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'first': 0.61; 'here:': 0.62; 'it!': 0.64; 'beat': 0.65; 'reply': 0.66; '2013': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=GcGWFHG290n60qDBkaFGQB6y6H8rpsYsjeeeyPY6FKE=; b=KvKWpHaHpc8ihGUpJYLhWVjz+YvQ3IQsPXjr/CWEn1JDIsKrwdLaifbADL806p/kc0 fpoFPg0+v16CQTYsXCeeFFW1+o33G+0+g251u15WRKuaiqB5n816LgXGI3SKyiTtMeFM zrG6kw0tK2arOQWesRNLuIMtwBaS1qaXt5R5YN6GBYrZPVMzE05206+90AubtuCV7I6T xDCkwq54N7Ma3CZKlm/X5C1d21x3mvI+gSpLkayZvi1Wu7LUOkjKlEBUL89/EHhOMCbR JwFLJobD8xQqupI/8OnIwECKFx1UyD90MYYwFacI2G/eu6pVgSAuUa3t5Ra+MT8+I7Od e2wA==
MIME-Version 1.0
X-Received by 10.221.10.14 with SMTP id oy14mr7781391vcb.34.1362411884507; Mon, 04 Mar 2013 07:44:44 -0800 (PST)
In-Reply-To <eefa1330-cab9-448f-a9a1-c5f34c4600de@googlegroups.com>
References <c25680d3-6814-4d5f-a5a2-aa4b9bb0c3a0@googlegroups.com> <eefa1330-cab9-448f-a9a1-c5f34c4600de@googlegroups.com>
Date Tue, 5 Mar 2013 02:44:44 +1100
Subject Re: Different behavior with multiprocessing
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.2844.1362411893.2939.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362411893 news.xs4all.nl 6980 [2001:888:2000:d::a6]:32957
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40458

Show key headers only | View raw


On Tue, Mar 5, 2013 at 2:35 AM, Tomas Kotal <tomas.kotal@gmail.com> wrote:
> Seems like I found the problem: os._exit probably takes as parametr unsigned char, so it uses as error code whatever value it gets modulo 256:
>
> os._exit(1)  # process.exitcode == 1
> os._exit(255)  # process.exitcode == 255
> os._exit(256)  # process.exitcode == 0
> os._exit(257)  # process.exitcode == 1
> os._exit(32512)  # process.exitcode == 0
>
> So on Linux it's necesary to call something like this:
> os._exit( os.system(cmd) >> 8 )
>
> Because the first byte of return value on Linux is number of signal which kills the process and the second one is actual exit code.

Yep. I had a reply part-written but you beat me to it! That is indeed
what you need if you want to chain return values.

However, why are you using os._exit? Check out the note here:

http://docs.python.org/2/library/os.html#os._exit

ChrisA

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


Thread

Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 06:31 -0800
  Re: Different behavior with multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-03-05 01:58 +1100
    Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:12 -0800
    Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:12 -0800
  Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:35 -0800
    Re: Different behavior with multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-03-05 02:44 +1100

csiph-web