#!/usr/bin/python2 #coding:utf8 import sys import time import os try: import RPi.GPIO as GPIO except RuntimeError: print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script") def cpu_temp(): with open("/sys/class/thermal/thermal_zone0/temp", 'r') as f: return float(f.read())/1000