Re: [Tutor] subprocess Popen PIPE error

2010-10-26 Thread Abhijeet Rastogi
Ya. Do it using python. Why do you want to use bash when you already have python? See, do something like this:- import os alldirs = os.listdir("/path/to/dir") DIRS = [] #Only the dirs you are interested in for i in alldirs: if i.find("deploy") is -1: L.append(i) if i.find("TEMPLATE"

Re: [Tutor] subprocess Popen PIPE error

2010-10-26 Thread Abhijeet Rastogi
Please read the documentation of Popen. You cannot pass arguments like that. >>> from subprocess import Popen,PIPE >>> import shlex >>> cmd="ls -l" >>> cmd=shlex.split(cmd) >>> p = Popen(cmd,stdout=PIPE,stderr=PIPE) or simply that means >>> p = Popen(['ls','-l'],stdout=PIPE,stderr=PIPE) Hope I

[Tutor] subprocess Popen PIPE error

2010-10-26 Thread Sean Carolan
What am I doing wrong here? >>> from subprocess import Popen, PIPE >>> cmd = 'ls -l' >>> p = Popen(cmd, stdout=PIPE, stderr=PIPE) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__ errread, errwrite) File "/usr/lib64/