[racket] Writing a file from a web servlet

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Jun 9 11:46:57 EDT 2010

This should work, so either the file is being written in an unexpected
location or the save-costs function is not be called. You could
diagnose the later with a simple printf statement. You could also try
a minimal servlet to ensure the file is being written in the location
you expect.

HTH,
N.

On Wed, Jun 9, 2010 at 4:36 PM, Curtis Dutton <curtdutt at gmail.com> wrote:
> I have a very simple web servlet application that tries to write data to a
> file as a sort of miniature database.
> Here is the code that writes the file.
> (define (save-costs costs)
>   (with-output-to-file
>       file-name
>       (lambda ()
>         (write (serialize costs)))
>     #:exists 'truncate
>     #:mode 'text))
>
> In normal scheme this code works fine and creates the file "costs.dat" and
> everything is merry.
> Inside the web server it does not create the file anywhere or update it
> thought the code executes without error.
> The web server is able to read the file on startup, just not write it.
> What am I doing wrong here?
>
> Thanks,
>      Curtis
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.