os.system error returns

Ian Kelly ian.g.kelly at gmail.com
Fri Jun 12 09:54:17 EDT 2015


On Jun 12, 2015 7:21 AM, "Grawburg" <grawburg at myglnc.com> wrote:
>
> I have a piece of code written for a Raspberry Pi with no explanation for
two of the lines -- and I can't find an explanation I understand.
>
> Here are the lines:
> 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?
> I recognize they're some kind of error returns, but don't know what they
mean.

Exit code 0 traditionally means success. The exit status is two bytes, with
the low-order byte normally containing the exit code and the high-order
byte containing the signal that caused the program to exit. So 256 would
appear to mean that modprobe exited due to SIGHUP, although that seems an
odd thing to test for here so I may be wrong.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150612/5420715f/attachment.html>


More information about the Python-list mailing list