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


Groups > comp.lang.python > #92520

Re: os.system error returns

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'exit': 0.07; 'get.': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'returns,': 0.09; 'statements': 0.09; 'programs.': 0.11; 'subject:error': 0.11; 'literals,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'status.': 0.16; 'comparing': 0.18; 'integer': 0.18; 'recognize': 0.22; 'code.': 0.23; 'sets': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'external': 0.27; 'error': 0.27; "skip:' 10": 0.30; 'values': 0.30; 'source': 0.31; 'gets': 0.32; 'to:addr:python-list': 0.35; 'but': 0.36; 'except': 0.36; 'there': 0.36; 'child': 0.36; 'subject:: ': 0.37; 'received:org': 0.38; 'say': 0.38; 'is,': 0.38; 'means': 0.39; 'whatever': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'some': 0.40; 'further': 0.60; "you'll": 0.61; 'different': 0.64; 'between': 0.65; '8bit%:40': 0.66; 'born': 0.66; 'skip:\xe2 10': 0.70; '8bit%:20': 0.72; '_o__)': 0.84; 'received:125': 0.84; 'vatican': 0.84; 'mean.': 0.91; '\xe2\x80\x9cthe': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: os.system error returns
Date Fri, 12 Jun 2015 23:43:04 +1000
References <2ebdfdf225c075b2f5ef350b06bc14f0@myglnc.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock sha1:uuti8IXk7R5/SDSIY4+V8//GuTY=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.420.1434116599.13271.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434116599 news.xs4all.nl 2934 [2001:888:2000:d::a6]:50114
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92520

Show key headers only | View raw


Grawburg <grawburg@myglnc.com> writes:

> if os.system('modprobe --first-time -q w1_gpio') ==0
>
> if os.system('modprobe -q w1_gpio') == 256:
>
> I know what the 'modprobe...' is, it's the 0 and the 256 I don't get.
> Where do these numbers come from?

They are integer literals, they come from the source code.

The statements are comparing those integers to the return value from
‘os.system’. The return value from ‘os.system’ is whatever was the child
process sets as its exit status.

> I recognize they're some kind of error returns, but don't know what
> they mean.

That's not up to Python, it's entirely set by the external program.

There is no standardisation of exit status values between different
programs. The best one can say is “exit status 0 means success”.
Anything further is specific to particular programs and is not
universal.

You'll need to see the documentation for ‘modprobe(1)’ to find out what
its different exit status values mean.

-- 
 \       “The Vatican is not a state.… a state must have people. There |
  `\    are no Vaticanians.… No-one gets born in the Vatican except by |
_o__)        an unfortunate accident.” —Geoffrey Robertson, 2010-09-18 |
Ben Finney

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


Thread

Re: os.system error returns Ben Finney <ben+python@benfinney.id.au> - 2015-06-12 23:43 +1000
  Re: os.system error returns Grant Edwards <invalid@invalid.invalid> - 2015-06-12 13:53 +0000

csiph-web