Logging sensor values in python on a raspberry pi