473,573 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pylab without X11

I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #1
3 2799
This may help you ... or not

You may have to change your backend :

p13 of the matplotlib user guide: backends
p17 how to change the backend in the matplotlibrc

An example of matplotlibrc ( backend choice is at the beginning ):
http://matplotlib.sourceforge.net/matplotlibrc

You may choose PS or SVG or pdf, there might be other possibilities, I
do not know
To save the file : savefig

Marc


Willem-Jan Vriend a écrit :
I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #2
This may help ... or not ( 2nd part )

try not to do pylab.figure()

in your script:
pylab.plot, or pylab.imshow or whatever you want to use
then
savefig("myFigu re.png") for example
do not use show()
in my case ( with the WXAgg backend ), it works, it generates the png file

Marc

Willem-Jan Vriend a écrit :
I want to use pylab (matplotlib) on a machine without X11. I'm trying to
generate onthefly graphics for an apache2 web service, so they do not
have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I got
the same error message.

Any help is very much appreciated.
Sep 30 '08 #3
Thanks that worked ! I changed the backend to Agg.

Allthough a problem there is that with the backend Agg you only can
write the resulting image to a file or a file like object, it does not
accept the (apache) request handler to write the file to. And I do not
want to save the file to disk first before sending to the client.

WJV

marc wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">This may
help you ... or not

You may have to change your backend :

p13 of the matplotlib user guide: backends
p17 how to change the backend in the matplotlibrc

An example of matplotlibrc ( backend choice is at the beginning ):
http://matplotlib.sourceforge.net/matplotlibrc

You may choose PS or SVG or pdf, there might be other possibilities, I
do not know
To save the file : savefig

Marc


Willem-Jan Vriend a écrit :
>I want to use pylab (matplotlib) on a machine without X11. I'm trying
to generate onthefly graphics for an apache2 web service, so they do
not have to be displayed on this machine !

When i do
pylab.figure()
I get the error
TclError: couldn't connect to display ":0.0"

I tried setting the DISPLAY environment variable to "", ":0.0" but I
got the same error message.

Any help is very much appreciated.

</div>
Oct 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2684
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my configuration : Fedora Core 3 Apache 2.0
3
4037
by: Dr. Colombes | last post by:
On my home laptop computer, I'm trying to install the appropriate modules so that Python version 2.3.3 and IDLE version 1.0.2 (with an "import matplotlib.matlab" statement) can produce nice MatLab-like plots. I have a matplotlib.matlab-capable Python set-up running OK on my office desktop, which I obtained after downloading and installing...
2
7799
by: Charles Krug | last post by:
List: I'm trying to us pylab to see what I'm doing with some DSP algorithms, in case my posts about convolution and ffts weren't giving it away. I've been using pylab's plot function, but I'm finding it a bit cumbersome. It works, but if I switch from the interactive window to the plot window and back, the plot window gets trashed.
6
17684
by: googlinggoogler | last post by:
Hiya, I've got a PIC microcontroller reading me humidity data via rs232, this is in ASCII format. I can view this data easily using hyperterminal or pyserial and convert it to its value (relative humidty with ord(input)) But what im trying to do is plot the data in real time, ideally with pylab - as it looks simple to use and simple is...
2
1807
by: Gary Wessle | last post by:
Hi I use debian/testing linux Linux debian/testing 2.6.15-1-686 I found some duplicate files in my system, I don't if the are both needed, should I delete one of the groups below and which one? -rw-r--r-- 1 root root 80375 2006-01-24 00:28 /usr/lib/python2.3/site-packages/matplotlib/pylab.py -rw-r--r-- 1 root root 96202 2006-05-07 13:44...
2
2711
by: timw.google | last post by:
Hi all. I installed matplotlib 0.87.3 under Python 2.4 on both Linux (FC3) and Windows XP Pro. On the linux install, I can import pylab, but when I try to do the same thing on the Windows installation, I get >>> from pylab import * Traceback (most recent call last): File "<pyshell#7>", line 1, in -toplevel-
0
1958
by: ehenlin | last post by:
Hi, How to make pylab work together with py2exe? Have anyone managed to build a stand alone exe with pylab package? I have made a small test script but that does not work. setup.py ------------
14
6733
by: amitsoni.1984 | last post by:
hi, I have some values(say from -a to a) stored in a vector and I want to plot a histogram for those values. How can I get it done in python. I have installed and imported the Matplotlib package but on executing the code =hist(eig, 10) # make a histogram I am getting an error saying "NameError: name 'hist' is not defined". Is there any...
1
2419
by: oyinbo55 | last post by:
I am trying to use the pylab plot command on my laptop running Ubuntu 6.06 (Dapper). Although the plot command works fine on my XP desktop at work, I cannot open the plot window on the laptop. I edited matplotlibrc to change interactive: to "True". In idle, I entered the commands: The terminal window closed abruptly when I typed the...
0
7771
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8009
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8198
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7771
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6406
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5289
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2194
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1296
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.