<div class="gmail_quote">On Thu, Sep 30, 2010 at 7:27 AM, R. Alan Monroe <span dir="ltr"><<a href="mailto:amonroe@columbus.rr.com">amonroe@columbus.rr.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
>> I'm needing to transfer the following shell construct to Python,<br>
>> plus save<br>
>> the output of execution:<br>
<br>
</div><div class="im">>> FTP_SITE='<a href="http://ftp.somesite.com" target="_blank">ftp.somesite.com</a>'<br>
>> ftp -a $FTP_SITE <<EOF<br>
>> binary<br>
>> prompt off<br>
>> cd /some_dir<br>
>> dir<br>
>> bye<br>
>> EOF<br>
<br>
</div>NB: If you use the ftp module (which works great), be sure to open all<br>
files in Binary mode. Voice of experience here.</blockquote><div><br>Thanks all, for the responses thus far. I was not aware of the ftplib module. This looks like it will take care of most of my needs.<br><br>However, output from these FTP commands are sent to stdout. Is there a way to redirect/capture stdout, as I need to parse the directory listings?<br>
<br>Thanks, again. <br></div></div><br>