diff options
author | erg <uinarf@autistici.org> | 2023-03-06 09:40:53 +0100 |
---|---|---|
committer | erg <uinarf@autistici.org> | 2023-03-06 09:40:53 +0100 |
commit | 137d2d58d967e837bc86ae8f33ae81396afc1298 (patch) | |
tree | ce1a2fef60f8bf303ad7ecf87090cfcca90d205a | |
parent | 359e051ec88b4daa1fe5cdb7921e747c4584fc46 (diff) | |
download | Pi_Relay-137d2d58d967e837bc86ae8f33ae81396afc1298.tar.gz Pi_Relay-137d2d58d967e837bc86ae8f33ae81396afc1298.tar.bz2 Pi_Relay-137d2d58d967e837bc86ae8f33ae81396afc1298.zip |
Fix for os.getuser() fails in certain conditions, replace with getpass.getuser()
-rw-r--r-- | py_relay.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py_relay.py b/py_relay.py index d492ab0..0c98d7f 100644 --- a/py_relay.py +++ b/py_relay.py @@ -8,7 +8,7 @@ Gets temperature from one wire sensor. Attempts to keep temperature between given min and max. Writes its own log as well as temperature data with timestamps to CSV file. """ -import os +import getpass import pigpio from math import isnan @@ -19,7 +19,7 @@ from csv import writer __author__ = "Franek Ćazarewicz-Muradyan" __licence__ = "GPL" __version__ = "0.0.1" -__status__ = "Proof of concept" +__status__ = "Development" # One wire temperature sensor settings W1_SENSOR_ID = '28-0517c1b121ff' @@ -32,7 +32,7 @@ TEMPERATURE_MIN = 20 TEMPERATURE_MAX = 24 # TEMPERATURE_MIN = 28 # TEMPERATURE_MAX = 32 -USERNAME = os.getlogin() +USERNAME = getpass.getuser() LOGNAME = f'/var/log/{USERNAME}/shroombox.log' DATA_FILE = f'/var/log/{USERNAME}/shroombox.csv' |