0

I'm new to the whole website world, so I apologize before hand if this is a duplicate question of some kind.

Important note: I am well aware this specific script won't update the graph. It's just a representation of the script's file path and the output that I want. The graph will update when my script is in place and the cron job is run properly.

I have a script that I'm running, say this one:

#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)

plt.xlabel('time (s)')
plt.title('Sine Wave')
plt.grid(True)
plt.savefig("home/bdmweath/public_html/images/script_output/test.png")

I'm having the script run once an hour, and I have the email set up and it's sending emails. The email I'm getting is:

/usr/local/cpanel/bin/jailshell: /usr/local/bin: is a directory

The cron job I'm running is:

/usr/local/bin -q home/bdmweath/public_html/scripts/my_script.py

HTML code:

<div class = 'class_name'>
     <h2>Header Text</h2>
     <a href = 'images/script_output/test.png'><img src='images/script_output/test.png' style="width:20%;height:20%;"></a>
</div>

Can anyone explain what is going on why it won't update?

1 Answer 1

2

It looks like you are trying to run your script using a directory "/usr/local/bin". Presumably you either want to run the script using python:

python -q /home/bdmweath/public_html/scripts/my_script.py

Or make the script executable and run it directly:

chmod +x my_script.py
...
/home/bdmweath/public_html/scripts/my_script.py
Sign up to request clarification or add additional context in comments.

2 Comments

I got it to run. I have to do python -x /directory/to/file. Now I'm runninng into an error saying "no module named matplotlib.
Do you have matplotlib installed in a virtualenv? You might also have it installed globally, but say for python 2 instead of 3 or vice versa?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.