plot2d in Lisp CGI (was: plot2d output "")



On 9/18/07, Rupert Swarbrick <rupert.swarbrick at lineone.net> wrote:
> On Mon, 17 Sep 2007 13:17:21 -0700 (PDT)
> Yigal Asnis <yigalasnis at yahoo.com> wrote:
>
> > It turns out that return value of plot2d ("") wasn't
> > problem. I suppressed it by (progn #$plot2d(...)$
> > (princ "something I need to print")) but CGI program
> > still stuck.
> > If I execute the CGI file from terminal, it works -
> > plot2d generates plot file and all other output work
> > as expected.
> > But if I point to CGI file with browser, the plot file
> > isn't generated and all commands after plot2d aren't
> > executed.
> > I think the problem is calling external function
> > (gnuplot) from CGI.
> > I use Apache with mod_cgi on Debian.
> >
> > Yigal Asnis
>
> Are you on *nix?
>
> I don't know much at all about cgi programming in general or with
> gnuplot in particular, but maybe there's a problem because gnuplot is
> an X11 program?
>
> In particular, try running some random X11 program (gnuplot,xeyes ?)
> from a console (Ctrl-Alt-F1) on Linux and you'll get a 5 sec. or so
> wait followed by an error message complaining that it was unable to
> communicate with the X server (because the DISPLAY variable was not set
> and it doesn't know who to ask).
>
> Running from Apache as a CGI script, your program might have a similar
> problem. Have you tried running your CGI script via a proper console? I
> think that would show whether this is the problem.

gnuplot does not require X to be running. The following produces a ps
file even from console (you need to set the plot_format to gnuplot,
the default gnuplot_pipes does not work for me).

plot2d(sin(x), [x,-5,5], [plot_format, gnuplot], [gnuplot_term, ps]);

HTH,
-- 
Andrej