Crontab cannot write to csv.

Asked 3 months ago, Updated 3 months ago, 13 views

I'm a beginner.While looking at the page below, I try to write the temperature to csv once a minute, but the following error occurred in the cron log and I cannot write it.

Visualize changes in room temperature - sideburns

Mar27 10:56:01 raspberrypi CRON [2995]: (pi) CMD ([2999] python3/home/pi/>/home/pi/temperature.csv)

Mar 27 10:56:01 raspberrypi CRON [2995]: (CRON) error (grandchild #2999 failed with exit status 2)

Mar 27 10:56:01 raspberrypi CRON [2995]: (pi) END ([2999] python3/home/pi/>>/home/pi/temperature.csv)

What should I do?Thank you for your cooperation.

import linecache



class DS18B20:
        self.raw=linecache.getline(DEVICE_PATH+DEVICE_NAME+FILE_NAME, 2) [29:]
        self.value = round (float(self.raw) / 1000.0, 1)

    DS = DS18B20()
    print("raw value="+DS.raw)
import time
import datetime
from DS18B20 import DS18B20

print(str(int(time.mktime(', '+str(DS18B20().value)))
*/1*** python3/home/pi/>/home/pi/temperature.csv

python python3 cron

2022-09-30 13:45

1 Answers

*** python/home/pi/>/home/pi/temperature.csv

What is the environment variable of cron? Is it set so that python can find the executable?
Even so, for your safety, you should write the full path of the command you want to execute.

2022-09-30 13:45

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.