nasty import behavior

A python module of mine could draw a plot, and so imports from matplotlib.
Actually, plotting is part of the module test that is in
if __name__==__main__

But this kills my job trying to run non-interactively.
This is IMO rather nasty behavior. matplotlib should not try to open the
display just because you import it.

    from matplotlib.pyplot import *
  File "/usr/lib64/python2.6/site-packages/matplotlib/", line 78,
in <module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "/usr/lib64/python2.6/site-packages/matplotlib/backends/",
line 25, in pylab_setup
  File "/usr/lib64/python2.6/site-
packages/matplotlib/backends/", line 10, in <module>
    from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
  File "/usr/lib64/python2.6/site-
packages/matplotlib/backends/", line 8, in <module>
    import gtk; gdk = gtk.gdk
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/", line
64, in <module>
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/", line
52, in _init
RuntimeError: could not open display

You need to set your backend to a non-GUI one (such as Agg) if you want
to run without a display. This FAQ answer may be helpful:



-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA