Hi
I am attempting to generate graphs using matplotlib/pyplot via a cron process. These scripts work perfectly fine when I am logged in and run the scripts on the command line, however they fail to run when they are set up as a cronjob. Even a simplified plotting routine does not work:
from matplotlib.pylab import plot
from matplotlib.pylab import savefig
plot([1,2,3,4])
savefig('test.png')
my crontab is configured like this:
SHELL= /bin/tcsh
45 8 * * * cd [path to script]; python graphtest.py
Thanks in advance,
···
--
Andre Wong
Gemini North Data Analyst
awong@...84...
(808) 974 2626
Andre, my guess is that there's an attempt made to connect to the
(non-existant) X server. You can disable this by forcing a backend that
doesn't need the X server. Try
import matplotlib
matplotlib.use('Agg')
before the rest of your script.
Andre Wong wrote:
···
Hi
I am attempting to generate graphs using matplotlib/pyplot via a cron
process. These scripts work perfectly fine when I am logged in and run
the scripts on the command line, however they fail to run when they are
set up as a cronjob. Even a simplified plotting routine does not work:
from matplotlib.pylab import plot
from matplotlib.pylab import savefig
plot([1,2,3,4])
savefig('test.png')
my crontab is configured like this:
SHELL= /bin/tcsh
45 8 * * * cd [path to script]; python graphtest.py
Thanks in advance,