[Tutor] system()? popen2()? How to execute a command & save its output?

ralf at schoenian-online.de ralf at schoenian-online.de
Thu Sep 30 12:13:04 CEST 2010

I've once written a script to sync my website with a local directory. I guess
that you will find anything you need in the FTPHelper class. Have a look at:
http://home.arcor.de/ralf_schoenian/websync/index.html At the bottom of the page
you can view and download the script.
Any questions are welcome.

James Hartley <jjhartley at gmail.com> hat am 30. September 2010 um 06:29

> I'm needing to transfer the following shell construct to Python, plus save the
> output of execution:
> FTP_SITE='ftp.somesite.com [http://ftp.somesite.com] '
> ftp -a  $FTP_SITE <<EOF
> binary
> prompt off
> cd /some_dir
> dir
> bye
> Here, the FTP client accepts commands from STDIN, so all commands are saved in
> a temporary file which is redirected to the client application.
> I also need to save whatever output is generated.  How can this be done in
> Python?
> Thanks.
> Jim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100930/b51fe150/attachment.html>

More information about the Tutor mailing list