Hello, If you set shell=False, then I think that arg2 should be separated into two different parts.
Also, arg3 could be set just to pattern (no need to add extra spaces or using str function). Best regards, Javier 2010/1/21 Tomas Pelka <tompe...@gmail.com>: > Hey all, > > have a problem with following piece of code: > > -------------------------------------------------- > import subprocess > > paattern = "python" > cmd = "/usr/bin/locate" > arg1 = " -i" > arg2 = " -d /var/www/books/mlocate.db" > arg3 = str(" " + pattern) > > p1 = subprocess.Popen([cmd, arg1, arg2, arg3], shell=False, > stdout=subprocess.PIPE, stderr=subprocess.PIPE) > (stdoutdata, stderrdata) = p1.communicate() > > print p1.returncode > print "%s -- %s" % (stdoutdata, stderrdata) > -------------------------------------------------- > > But return code is always 1 and command do not return any result/error > (stdoutdata, stderrdata are None). If I run this command (/usr/bin/locate -i > -d /var/www/books/mlocate.db python) from standard shell everything goes > fine. > > Could you please give me an advice what I'm doing wrong? > > Thanks > Cheers > > -- > Tom > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list