I have a matplotlib application which can display a plot or write it
to a file based on command line flags. I have discovered that if it is
run without DISPLAY set (say, from a crontab file) that the default
backend (I have no matplotlibrc file) attempts to chat with X, causing
crashes. I've worked around this like so:

import os
import matplotlib
if not os.environ.get("DISPLAY"):
    # Allow non-interactive use (e.g. running with -p from cron)
    matplotlib.use("Agg")

It seems kind of kludgy to have to do this in all matplotlib
applications. Could this be done within matplotlib itself?

Thx,

Skip

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to