zdravim, On Thu, Jan 21, 2010 at 09:44:55AM +0100, Tomas Pelka wrote: > Dobry napad, predelal sem tedy na: > > -------------------------------------------------- > cmd = "/usr/bin/locate" > arg1 = " -i" > arg2 = " -d /var/www/books/mlocate.db" > arg3 = str(" " + pattern) >
Chyba je formatu argumentu arg1, atd. Ta mezera na zacatku tam nesmi byt. Zkuste: arg1 = "-i" arg2a = "-d" arg2a = "/var/www/books/mlocate.db" arg3 = str(pattern) p1 = subprocess.Popen([cmd, arg1, arg2a, arg2b, arg3], shell=False, ...) Zbytek uz je spravne, pokud argumenty predavate jako list pak je skutecne treba zadat je oddelene. Pokud chcete zadat prikaz jako jeden string pak pouzijte `shell=True` a namistu listu zadejte string: p1 = subprocess.Popen("/usr/bin/locate -i -d file pattern", shell=True, ...) > (stdoutdata, stderrdata) = p1.communicate() > > print p1.returncode > print "%s -- %s" % (stdoutdata, stderrdata) > -------------------------------------------------- > > Ale stale vraci 1 a zadny vysledek. > honza. -- Heriot-Watt University is a Scottish charity registered under charity number SC000278. _______________________________________________ Python mailing list Python@py.cz http://www.py.cz/mailman/listinfo/python