473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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 2792
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("myFigure.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
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...
3
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...
2
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...
6
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...
2
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...
2
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...
0
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
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.