Danke Euch
Python
#!/usr/bin/python
import subprocess
def WhichRaspi() :
# identify Raspi
# "https://forum-raspberrypi.de/forum/thread/24244-ist-das-ein-raspi-b/"
DEBUG = False # see additional info
SEECP = False # see cpuinfo
with open("/proc/cpuinfo") as inf:
revision=[line for line in inf if 'Revision' in line][0].split(':')[1].strip()
inf.close()
if DEBUG : print ("Found revision %s" % revision)
if SEECP :
inf=open("/proc/cpuinfo",'r')
txt=inf.read()
print (txt)
inf.close()
if revision == '0002' :
MB = 256; Model= 'Model B Revision 1.0'
elif revision == '0003' :
MB = 256; Model= 'Model B Revision 1.0 + ECN0001 (no fuses, D14 removed)'
elif revision >= '0004' and revision <= '0006':
MB = 256; Model= 'Model B Revision 1.0 + ECN0001 (no fuses, D14 removed)'
elif revision >= '0007' and revision <= '0009' :
MB = 256; Model= 'Model B Revision 2.0 Mounting holes'
elif revision >= '000d' and revision <= '000f' :
MB = 512; Model= 'Model B Revision 2.0 Mounting holes'
elif revision == '0010' :
MB = 512; Model= 'Model B+'
elif revision == '0011' :
MB = 512; Model= 'Compute Module'
elif revision == '0012' :
MB = 256; Model= 'Model A+'
elif revision == 'a01041' :
MB = 1024; Model= 'Pi 2 Model B - (Sony, UK)'
elif revision == 'a21041' :
MB = 1024; Model= 'Pi 2 Model B - (Embest, China)'
elif revision == '900092' :
MB = 512; Model= 'PiZero'
else :
MB = 0; Model= 'not known - wrong revision code?'
print (Model)
return (revision,MB,Model)
if __name__ == '__main__':
x=WhichRaspi()
print ('revision: ',x[0],' with ',x[1],'MB Type : ',x[2])
Alles anzeigen
@famp
"BTW: lmgtfy hilft sehr bei Fehlermeldungen undefined"
Du hast recht aber ich habe mit dem OOP-Kauderwelsch ein echtes Problem ... sorry