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


Groups > comp.lang.python > #40454

Re: Different behavior with multiprocessing

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <tomas.kotal@gmail.com>
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; 'value,': 0.03; 'linux,': 0.05; 'correct.': 0.07; 'exit': 0.07; 'unrecognized': 0.07; 'command.': 0.09; 'encodes': 0.09; 'exited': 0.09; 'linux.': 0.09; 'subject:skip:m 10': 0.09; 'to:addr:comp.lang.python': 0.09; 'unix,': 0.09; 'cc:addr:python-list': 0.10; '127': 0.16; 'subject:Different': 0.16; 'shell': 0.18; 'windows': 0.19; 'work,': 0.22; 'cc:2**0': 0.23; 'this:': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'linux': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; "doesn't": 0.28; 'fine': 0.28; 'piece': 0.29; 'ret': 0.29; 'code': 0.31; 'point': 0.31; 'url:python': 0.32; 'print': 0.32; 'like:': 0.33; 'received:google.com': 0.34; 'exist': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'child': 0.36; 'url:library': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'url:docs': 0.38; 'real': 0.61; 'strange': 0.62; 'between': 0.63; 'more': 0.63; 'information:': 0.74; 'url:system': 0.91
X-Received by 10.182.146.6 with SMTP id sy6mr47802obb.38.1362409922819; Mon, 04 Mar 2013 07:12:02 -0800 (PST)
Newsgroups comp.lang.python
Date Mon, 4 Mar 2013 07:12:02 -0800 (PST)
In-Reply-To <mailman.2840.1362409142.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=94.113.240.188; posting-account=LaiBCAoAAADzpX8PXrgiIAU3u6QMN99f
References <c25680d3-6814-4d5f-a5a2-aa4b9bb0c3a0@googlegroups.com> <mailman.2840.1362409142.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 94.113.240.188
MIME-Version 1.0
Subject Re: Different behavior with multiprocessing
From Tomas Kotal <tomas.kotal@gmail.com>
To comp.lang.python@googlegroups.com
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>
Message-ID <mailman.2843.1362409932.2939.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362409932 news.xs4all.nl 6842 [2001:888:2000:d::a6]:39030
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40454

Show key headers only | View raw


> Under Unix, the return value from os.system() encodes more than one
> 
> piece of information:
> 
> 
> 
> http://docs.python.org/2/library/os.html#os.system
> 
> http://docs.python.org/2/library/os.html#os.wait
> 
> 
> 
> 32512 is 127*256, meaning that the shell exited with return code 127
> 
> when given an unrecognized command.
> 
> 
> 
> ChrisA

Well the point is not the difference between return values of os.system under Windows and Linux.

The point is that I set the exist code of child process with os._exit() which works fine on Windows but on Linux the process.exitcode returns always 0.

What is very strange is, that if I set return code to some other value, like:

...
os._exit( len(cmd) )
...

Then I got exit codes 3 and 2 under Linux, which is correct. But when I do something like this:

...
ret = os.system(cmd)
print ret # this print real value, like 32512
os._exit(ret) # exitcode of this child process will be 0 on Linux
...

It doesn't work, which seems very strange to me.

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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