Uncategorized

Program stops after initiated with CRONTAB – runs fine directly from mu


Summary of issue:
1) Program runs fine when invoked with mu and running. However, when automatically initiated via crontab, program halts with no errors.

Hardware/Software Configuration:
Raspberry Pi 4
Using Mu for python development
Latest firmware/software updates

Snippet of program:

# Load library routines, docs at: https://gpiozero.readthedocs.io/en/stable/
import gpiozero
from time import sleep
import datetime
import logging
import smtplib
import os

def eMail(message, subject): # using gmail
print(“@93.. Start of eMail”)
from_address=”[email protected]
to_address=ini_status_email_to
print(“@96…about to open object with smtplib”)
mymail=smtplib.SMTP(‘smtp.gmail.com’,587)
print(“@98 … starting handshake…”) # THIS LINE NEVER EXECUTES UNDER CRONTAB

Line added to crontab:
@reboot python3 /home/pi/mu_code/Christmas_Tree_Watering_7.py >> tafout.txt&

Output from crontab (tafout.txt) after reboot
in INIRead, ini_status_email_detail str= 4
@151 Write initial startup to log file
@153 …
@155
@157..
@93.. Start of eMail
@96…about to open object with smtplib
<<NOTHING ELSE …. SHOULD SEE @98 … starting handshake >>



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *