creating drum

Hi all,
I have installed the 1.0.1 version of obspy and I would to plot drums of all stations. every 20 minutes.
I have made a sript to do that, and in line mode works well, but with cron i have this error:

‘no display name and no $DISPLAY environment variable’

How can I work around to solve this?



Hi Sergio,

When you run a script through crontab, it typically does not have a shell environment set,
unless you explicitly set it.
Your error suggests it needs the DISPLAY variable set and it is not.

So maybe figure out how to set DISPLAY for your shell, e.g.,:
in cshrc: setenv DISPLAY some_machine:0.0 (or something)
in bash: export DISPLAY …

and then add a line to do this inside your script.

Hope this helps,

The problem description left some room for interpretation..

I'm also assuming you're running a cronjob, and to add to Mike's valid
statements, if you're trying to save your plots to local files (as
opposed to open interactive windows), you want to select an
non-interactive matplotlib backend (e.g. agg, pdf, ...) *right at the
top of your script before other imports*, like..

import matplotlib


Hi Tobias and Mike,
thanks for your answers.

I have used the Tobias’s solution and now works well.



Hi Sergio,

You can also directly put the DISPLAY in the crontab like in this example:

00 * * * * DISPLAY=:0 /usr/bin/python /home/user/
Sébastien Bonaimé
Tel: +33 (0)1 83 95 75 31
GEOSCOPE Dept Sismologie
Institut de Physique du Globe Paris
Bureau 337
1 rue Jussieu
75005 Paris