Accessing shell output from HTTP
brendon.wickham at gmail.com
Sun Mar 29 13:53:38 CEST 2009
I would like users of my web application to be able to download a backup
file of a database (using* *MySQL's *mysqldump* command).
My strategy is to use *zipfile* to create a zip file object (with the *
mysqldump* output as the contents of the zipped file) and then use *
sys.stdout* to send the zip file object to the user as a file for them
The zipping bit and file delivery is all sorted. Getting the output from *
mysqldump* is my problem and I'm not even sure (given that I'm calling shell
via an HTTP thread/process) it is even possible.
This is as far as I've got:
import subprocess as sp
p1 = sp.Popen('mysqldump --opt
If I type the above into a Python prompt and print *backupfile* I will get
the expected result, but when I'm going through CGI nothing is being
returned by communicate().
Is this possible? Or am I barking up the wrong tree?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list