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

2010-09-30 Thread r...@schoenian-online.de
Hi,   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 w

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

2010-09-29 Thread Chris Fuller
You might also consider pexpect. http://pexpect.sourceforge.net/ It's designed for interactive console applications like ftp. For popen() style access, the recommended approach is the subprocess module. You should be able to find an example in the docs to fit your application. http://docs.pyth

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

2010-09-29 Thread vijay
command_name = 'ps -ax|grep  sometext >>/tmp/output.txt'f = os.popen('%s' %command_name) fp = open('/tmp/output.txt') print fp.readlines() With Regards Vijay --- On Thu, 30/9/10, James Hartley wrote: From: James Hartley Subject: [Tutor]

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

2010-09-29 Thread James Hartley
I'm needing to transfer the following shell construct to Python, plus save the output of execution: FTP_SITE='ftp.somesite.com' ftp -a $FTP_SITE <___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.o