Daniel O'Connor wrote:
> Hi,
> I am trying to use matplotlib non-interactively but if I don't have
> DISPLAY set then wx barfs even though I have tried forcing the backend,
> etc..

This is characteristic of matplotlib that I think should be considered a 
major bug, but I have not gotten around to fixing it: you have to call 
matplotlib.use() *before* importing pylab for it to have any effect.  If 
you call it after the first import of pylab, it is silently ineffective, 
hence highly misleading. Many people are caught by this "gotcha".

I will fix this shortly by making matplotlib.use() raise an exception if 
matplotlib.backends has already been loaded.

Eric

> 
> eg..
> [midget 16:51] ~/projects/beermon >python
> Python 2.5.1 (r251:54863, Aug 14 2007, 11:27:14)
> [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pylab, matplotlib
> matplotlib.use>>> matplotlib.use('agg')
>>>> fig = pylab.figure()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.5/site-packages/matplotlib/pylab.py", line 
> 859, in figure
>     figManager = new_figure_manager(num, figsize=figsize, dpi=dpi, 
> facecolor=facecolor, edgecolor=edgecolor, frameon=frameon, 
> FigureClass=FigureClass, **kwargs)
>   File 
> "/usr/local/lib/python2.5/site-packages/matplotlib/backends/backend_wxagg.py",
>  line 134, in new_figure_manager
>     backend_wx.wxapp = wx.PySimpleApp()
>   File 
> "/usr/local/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", 
> line 7791, in __init__
>     wx.App.__init__(self, redirect, filename, useBestVisual, clearSigInt)
>   File 
> "/usr/local/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", 
> line 7700, in __init__
>     self._BootstrapApp()
>   File 
> "/usr/local/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", 
> line 7352, in _BootstrapApp
>     return _core_.PyApp__BootstrapApp(*args, **kwargs)
> SystemError: wxEntryStart failed, unable to initialize wxWidgets!  (Is 
> DISPLAY set properly?)
> 
> Same problem if I try Cairo.
> I had a google but no luck, can anyone help me out?
> 
> Thanks.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to