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,
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to