Error TclError: no display name and no $DISPLAY environment variable

"Deen Sethanandha" <khundeen@...287...> writes:

  I use matplotlib as part of my Trac plugin. I got this error when I try
to access the web site that use my plugin. [...]

File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line 876, in
figure
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py",
line 88, in new_figure_manager
File "lib-tk/Tkinter.py", line 1639, in __init__

Your plugin is importing pylab, which automatically imports the TkAgg
backend based on your .matplotlibrc setting, and this makes no sense
in a non-interactive environment. The quick way to make this work is
to replace "import pylab" by the following lines:

import matplotlib
matplotlib.use('Agg')
import pylab

See also: examples/webapp_demo.py.

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

Thanks a lot,

   I am very new to using the matplotlib. I am wondering if I can use
just matplotlib without using pylab at all? I have rough idea that I
can try to find the class that has the function pylab has and use it
instead

  Please let me know what I need to be be aware of?

Thanks,
Deen

···

On 8/24/07, Jouni K. Seppänen <jks@...397...> wrote:

"Deen Sethanandha" <khundeen@...287...> writes:

> I use matplotlib as part of my Trac plugin. I got this error when I try
> to access the web site that use my plugin. [...]
>
> File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line 876, in
> figure
> File
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py",
> line 88, in new_figure_manager
> File "lib-tk/Tkinter.py", line 1639, in __init__

Your plugin is importing pylab, which automatically imports the TkAgg
backend based on your .matplotlibrc setting, and this makes no sense
in a non-interactive environment. The quick way to make this work is
to replace "import pylab" by the following lines:

import matplotlib
matplotlib.use('Agg')
import pylab

See also: examples/webapp_demo.py.

--
Jouni K. Seppänen
http://www.iki.fi/jks

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users