On Thursday, September 1, 2011, CompBio <roger...@cs.colostate.edu> wrote:
>
> I'm trying to get a script to work in batch mode to produce a large number
of
> plots.  I've got the following sequence of imports in a matplotlib Python
> script:
>
> import matplotlib, os, sys
> ...
> if file_ext == 'png' :
>    sys.stderr.write('Using PNG output format\n')
>    matplotlib.use('agg')
> elif file_ext == 'pdf' :
>    sys.stderr.write('Using PDF output format\n')
>    matplotlib.use('PDF')
>
> from pylab import *
>
> ... remainder of plotting code ...
>
> At first this appeared to work without any problems.  I could kick off a
job
> in background, log off the machine and return later when all the graphs
had
> been produced.
>
> Now I get this RuntimeError exception.  Is there anything else I need to
do
> to convince matplotlib that it doesn't need my local display?
>
> thanks!
> --

Without the stack trace, it would be hard to tell.  Plus, there is already
logic in the backends to switch to PDF and such for saving files.  It should
only be necessary to set the backend to AGG if you want a headless batch
script.

Ben Root
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to