Simple python cgi question

Domenico grayshade at libero.it
Thu Sep 18 00:28:49 CEST 2003


> First of all, I'm not sure that the easiest way to do this is with 
> python ...

python works great as a glue language. and you can *definitely* write
that script in python.

> I'd like to set up a web page that would accept a text file, process it 
> with a local program, and then make available generated pdf and 
> postscript files for downloading.

no problem at all -- use os.system() or open a pipe via popen. then
serve a page with links to the generated files. finally (if you're a
1337 sysadmin) set up a cron job which every hour deletes .pdf and .ps
files older than (let's say) 5 minutes.

> I'd like to limit the size of the file to be uploaded.

read the file into a buffer and stop reading after reaching the size
you decide. (disclaimer: I've never done this myself ;)

domenico




More information about the Python-list mailing list