Why does my cronjob not send the email from my script? [closed]
2024/11/15 21:32:04
Crontab script running from sh-3.2 (logged in as root) is:
* * * * * python /Users/tony/Documents/Python_Projects/Stock_Earnings_5.py #send an email every minute
Stock_Earnings_5 sends an email based on the logic.
Currently Stock_Earnings_5 works independently and sends out the email when manually running it from shell sh-3.2 (logged in as root).
crontab also works for "hello world" to terminal.
So in summary, crontab works for hello world program to terminal, and Stock_Earnings_5 works if called independently of crontab, but when crontab calls Stock_Earnings_5 it doesn't send email.
Answer
To properly post my comment above:
Keep in mind that the environment in which cron runs has different (minimal) variables that your user environment. Therefore, it might be (and usually is) necessary to provide the explicit path to your python executable.
The path to your default python executable can be found using the which python command.
Example:
$ which python
/home/username/anaconda3/bin/python
I made this program where I am putting labels on a grid without saving them in a variable. I do this because then I can for loop through a list of classes and get the data from each class in and add th…
I would like to change every second row of my data frame.I have a df like this:Node | Feature | Indicator | Value | Class | Direction
--------------------------------------------------------
1 | …
Im new at programing and Im trying to check a piece of code that keeps giving me this error:
t[i] = t[i - 1] + dt
IndexError: list index out of rangeThe code is the following:
dt = 0.001t = [0]
for i i…
What is the best way to stop a while loop in Python mid-way through the statement? Im aware of break but I thought using this would be bad practice.For example, in this code below, I only want the pro…
With Selenium and Chrome webdriver on MacOS need to click dropdown element. But always have an error that cant find. Have this html code on a page where it located:<select id="periodoExtrato&qu…
Im struggling with a problem to send a cv2 videostream (webcam) to a server (which shall be used later for face recognition).
I keep getting the following error for the server:
Traceback (most recent c…
This question already has answers here:How to get the Cartesian product of multiple lists(20 answers)Closed 7 years ago.Suppose I have list [[a, b, c], [d, e], [1, 2]]I want to generate list where on t…
Is there in native Python 3.X library or in scipy/numpy/matplolib libraries a function or their short set which could help me to draw a plot similar to this one(?):What would be an efficient way to ac…
I have some raw .IMG format files which Im converting to .jpg using ImageMagick to apply a CNN Classifier. The converted images, however have a black vertical line splitting the image into two. The par…
Im trying to implement an OMR using pythons CV2.
As part of the code I need to find the corners of the choices box (rectangulars) however I ran into difficulty causes by the grade sheet template.
In th…