Hi there,<br><div class="gmail_quote"><br>I would like users of my web application to be able to download a backup file of a database (using<b> </b>MySQL's <b>mysqldump</b> command). <br><br>My strategy is to use <b>zipfile</b> to create a zip file object (with the <b>mysqldump</b> output as the contents of the zipped file) and then use <b>sys.stdout</b> to send the zip file object to the user as a file for them download.<br>

<br>The zipping bit and file delivery is all sorted. Getting the output from <b>mysqldump</b> is my problem and I'm not even sure (given that, as I understand it, it's an asynchronous call to shell via an HTTP thread) it is even possible.<br>

<br>This is as far as I've got:<br><br>        import subprocess as sp<br>        p1 = sp.Popen('mysqldump --opt --user=[username]--password=[password] [databasename]',stdout=sp.PIPE,shell=True)<br>        backupfile=p1.communicate()[0]<br>

<br>If I type the above into a Python prompt and print <b>backupfile</b> I will get the expected result, but when I'm going through CGI (the script, called from a web browser, is supposed to capture the output into the variable) nothing is being returned by communicate().<br>
<br>Is this possible? Or am I barking up the wrong tree?<br>
<br>Cheers,<br><font color="#888888"><br>Brendon<br>
</font></div><br>