Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running from boot
#1
I am trying to run a DS18B20 temp sensor to trigger a relay. My code works in Thonny on a Rasp Pi4b. I am using sudo crontab -e and adding:
@reboot python /home/pi/DS18B20SensorRelay.py

The path shown is correct. While the program runs in Thonny, it won't run at sudo reboot. In the terminal I get the following message:

Running at boot
Traceback (most recent call last):
from w1thermsensor import W1ThermSensort
Import Error: No module named w1thermsensor.

I loaded the module again in it seemed to load correctly. The program still runs in Thonny. Not sure what is going on.
PS I loaded a simple LED blink program and it ran at boot, so the problem has to be with the w1thermister module.

My code starts like this:
import RPi.GPIO as GPIO
from w1thermsensor import W1ThermSensor
import time

the rest is the code to turn on the rely at a certain temp.

Appreciate any help. Like does the w1thermsensor module have to be in a certain directory. I just let it load and let Pi decide.
Reply


Messages In This Thread
Running from boot - by Murray6301 - Nov-02-2020, 08:59 PM
RE: Running from boot - by Larz60+ - Nov-03-2020, 03:19 AM
RE: Running from boot - by Murray6301 - Nov-06-2020, 08:21 PM
RE: Running from boot - by Larz60+ - Nov-06-2020, 10:39 PM
RE: Running from boot - by Murray6301 - Nov-07-2020, 03:55 PM
RE: Running from boot - by snippsat - Nov-07-2020, 05:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Script won't run at boot ebolisa 6 2,542 Mar-21-2020, 08:18 PM
Last Post: ebolisa
  Console crash after boot. friendlymegalomaniac 1 2,580 Apr-07-2018, 05:44 PM
Last Post: wavic
  find my system is single boot or dual boot using python Sachin_d 2 2,802 Nov-02-2017, 09:29 AM
Last Post: Sachin_d

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020