From: Daniel O'C. <da...@do...> - 2007-10-02 07:25:27
|
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.. 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 =3D 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 8= 59, in figure figManager =3D new_figure_manager(num, figsize=3Dfigsize, dpi=3Ddpi, fa= cecolor=3Dfacecolor, edgecolor=3Dedgecolor, frameon=3Dframeon, FigureClass= =3DFigureClass, **kwargs) File "/usr/local/lib/python2.5/site-packages/matplotlib/backends/backend_= wxagg.py", line 134, in new_figure_manager backend_wx.wxapp =3D wx.PySimpleApp() File "/usr/local/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core= =2Epy", 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= =2Epy", line 7700, in __init__ self._BootstrapApp() File "/usr/local/lib/python2.5/site-packages/wx-2.6-gtk2-unicode/wx/_core= =2Epy", line 7352, in _BootstrapApp return _core_.PyApp__BootstrapApp(*args, **kwargs) SystemError: wxEntryStart failed, unable to initialize wxWidgets! (Is DISP= LAY set properly?) Same problem if I try Cairo. I had a google but no luck, can anyone help me out? Thanks. =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C |
From: <jk...@ik...> - 2007-10-02 08:01:57
|
"Daniel O'Connor" <da...@do...> writes: > 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 should probably be in the FAQ... you need to set the backend before you import pylab, because importing pylab reads your matplotlibrc file and does all sorts of setup: import matplotlib matplotlib.use('agg') import pylab -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Daniel O'C. <da...@do...> - 2007-10-02 08:07:00
|
On Tue, 2 Oct 2007, Jouni K. Sepp=E4nen wrote: > "Daniel O'Connor" <da...@do...> writes: > > 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 should probably be in the FAQ... you need to set the backend > before you import pylab, because importing pylab reads your > matplotlibrc file and does all sorts of setup: > > import matplotlib > matplotlib.use('agg') > import pylab Ahah, thanks - works much better now, I wondered why I couldn't affect=20 the backend :) In the FAQ would be very nice! PS thanks to all the devs for matplotlib, it is very useful! =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C |
From: Eric F. <ef...@ha...> - 2007-10-02 08:10:18
|
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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |