Error when python script run as cgi script

sophie_newbie paulgeeleher at gmail.com
Mon Oct 22 07:09:31 EDT 2007


On Oct 21, 7:28 pm, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Sun, 21 Oct 2007 09:50:54 -0700, sophie_newbie
> <paulgeele... at gmail.com> declaimed the following in comp.lang.python:
>
> > Hi, I'm running a python script which if I run from the command line
> > as root runs fine. But if I run it through the web-browser as a cgi
> > script gives the following error "Error in X11: unable to start device
> > PNG".
>
> > Now I should say that this python script is calling fucntions in R (a
> > scripting languange used in statistics) using the python module RPy,
> > so this I dunno if this is entirely a Python question, because as far
> > as I can see the error is being thrown by R. But then as I say, when
> > the script is run by the root user from the command line everything
> > goes off without a hitch.
>
>         Ah, but does it run if you boot into a NON-graphical command shell
> mode...
>
>         That error message looks suspiciously like something is trying to
> open a graphical display window... A web-server likely does not have any
> graphical environment.
> --
>         Wulfraed        Dennis Lee Bieber               KD6MOG
>         wlfr... at ix.netcom.com              wulfr... at bestiaria.com
>                 HTTP://wlfraed.home.netcom.com/
>         (Bestiaria Support Staff:               web-a... at bestiaria.com)
>                 HTTP://www.bestiaria.com/

Ya thanks looks like you're actually right. The strange thing is that
the program, when run from a graphical command line, doesn't actually
open any display window. Although the code doesn't run when executed
as a webserver, most likely, as you pointed out, because there is no
graphical environment. I wonder if there any way I can somehow enable
a graphical environment for the webserver, or do I have to re-write
the underlying code?




More information about the Python-list mailing list