barchart website

hello, I want to create a barchart on a website, somebody

    > advised me to use matplotlib and it does look very
    > promising. The problem that I now face is that I can't
    > seem to get things right, the following code results in
    > an import error:

    > from cgi import escape

    > try: import cgitb cgitb.enable() except: sys.stderr =
    > sys.stdout

    > # test import pylab import pylab

    > Does this mean that the webserver doesn't have pylab
    > installed or am I missing something? (bit of a newbie in
    > this area, so please bear with me...)

To run matplotlib in a web app server, you will probably want to set
"backend : Agg" in your .matplotlibrc file. matplotlib supports
output to a variety of image devices and GUIs, and agg is a good
choice to make nice PNGs for app servers. See
http://matplotlib.sf.net/.matplotlibrc. On a standard linux install,
this file would be placed in /usr/share/matplotlib/.matplotlibrc, and
i can be copied to your HOME directory and edited. Often times HOME
is not net in an app server environment. You either need to set it,
or take a look at
http://groups-beta.google.com/group/comp.lang.python/msg/09eac15acef8ee40,
which describes some possible solutions. matplotlib needs a directory
that is can write to to save some font cache information, and the link
above describes the role of the environment variables HOME and
MATPLOTLIBDATA in the choices matplotlib makes.

As for your error, I suggest taking a minimal matplotlib script

import pylab
pylab.plot([1,2,3])
pylab.savefig('test.png')

and running it with

python myscript.py --verbose-helpful

and report any output and/or errors the script produces. Saying that
you got an import error, without giving us the exact error message`,
doesn't help us help you.

Good luck!
JDH