Operation check
Raspberry Pi2 + raspbian
CentOS 6.5
I want to distinguish whether the execution environment is CentOS or Raspberry Pi from the python code.
reference http://raspberrypi.stackexchange.com/questions/5100/detect-that-a-python-program-is-running-on-the-pi
151202b.py
import os
print os.uname()
Results on Raspberry Pi 2
$ python 151202b.py
('Linux', 'raspberrypi', '4.1.7-v7+', '#817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015', 'armv7l')
Results on CentOS
$ python 151202b.py
('Linux', 'localhost.localdomain', '2.6.32-431.el6.i686', '#1 SMP Fri Nov 22 00:26:36 UTC 2013', 'i686')
You can tell if it's a Raspberry Pi by including the keyword raspberry pi.
Recommended Posts