Re: [Tutor] Running external commands from Python

2010-06-26 Thread Alan Gauld
"Randy Kao" wrote In trying to do this in Python, I think I've read a couple ways to do this. through: os.popen, os.popen2, os.popen3, os.system, commands.getoutput() This is historically one of the things that Python has had trouble with. The things you list have all been introduced o

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
On Fri, Jun 25, 2010 at 8:43 PM, David Hutto wrote: > On Fri, Jun 25, 2010 at 9:37 PM, Randy Kao wrote: >> Thanks for the great and quick feedback from everyone! >> That definitely clears things up. >> -Randy > > And I was like...me too. Just to clarify, it looks like subprocess is intended to r

Re: [Tutor] Running external commands from Python

2010-06-25 Thread David Hutto
On Fri, Jun 25, 2010 at 9:37 PM, Randy Kao wrote: > Thanks for the great and quick feedback from everyone! > That definitely clears things up. > -Randy > On Fri, Jun 25, 2010 at 5:16 PM, Steven D'Aprano > wrote: >> >> On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: >> > Hi all, >> > >> > I'm a n

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Randy Kao
Thanks for the great and quick feedback from everyone! That definitely clears things up. -Randy On Fri, Jun 25, 2010 at 5:16 PM, Steven D'Aprano wrote: > On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: > > Hi all, > > > > I'm a newbie to Python (switching from Perl) and had a question about >

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
On Fri, Jun 25, 2010 at 7:48 PM, David Hutto wrote: > On Fri, Jun 25, 2010 at 8:16 PM, Steven D'Aprano wrote: >> On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: >>> Hi all, >>> >>> I'm a newbie to Python (switching from Perl) and had a question about >>> the best way to run external commands in

Re: [Tutor] Running external commands from Python

2010-06-25 Thread David Hutto
On Fri, Jun 25, 2010 at 8:16 PM, Steven D'Aprano wrote: > On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: >> Hi all, >> >> I'm a newbie to Python (switching from Perl) and had a question about >> the best way to run external commands in Python. > [...] >> through: os.popen, os.popen2, os.popen3,

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Steven D'Aprano
On Sat, 26 Jun 2010 08:46:17 am Randy Kao wrote: > Hi all, > > I'm a newbie to Python (switching from Perl) and had a question about > the best way to run external commands in Python. [...] > through: os.popen, os.popen2, os.popen3, os.system, > commands.getoutput() os.system is the oldest way, a

Re: [Tutor] Running external commands from Python

2010-06-25 Thread Luke Paireepinart
Subprocess module is the preferred strategy when You want to communicate with the command you're running. If not, you can use os.system. Sent from my iPhone On Jun 25, 2010, at 5:46 PM, Randy Kao wrote: > Hi all, > > I'm a newbie to Python (switching from Perl) and had a question about the >

[Tutor] Running external commands from Python

2010-06-25 Thread Randy Kao
Hi all, I'm a newbie to Python (switching from Perl) and had a question about the best way to run external commands in Python. In doing some reading I'm confused about which is the best way to accomplish this. With Perl, the way I went about running commands was by opening a filehandle and parsi