Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92520 > unrolled thread
| Started by | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| First post | 2015-06-12 23:43 +1000 |
| Last post | 2015-06-12 13:53 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2015-06-12 23:43 +1000 |
| Subject | Re: os.system error returns |
| Message-ID | <mailman.420.1434116599.13271.python-list@python.org> |
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
[toc] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2015-06-12 13:53 +0000 |
| Message-ID | <mleo7v$b5p$2@reader1.panix.com> |
| In reply to | #92520 |
On 2015-06-12, Ben Finney <ben+python@benfinney.id.au> wrote:
> 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.
It's modprobe(8), and all the man page says is that it returns
non-zero if you try to remove or insert a module it can't find.
Explicitly checking for an os.system() return value of 1<<8 seems like
a pretty bad idea to me, since there's nothing in the modprobe docs
that gurantees it will return 1 under some particular conditions.
--
Grant Edwards grant.b.edwards Yow! YOU PICKED KARL
at MALDEN'S NOSE!!
gmail.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web