TEST=`which test` equivalent in python?

2009-01-24 Thread Jay Jesus Amorin
Hi, Kindly help. import sys, os, string *SVNLOOK_PATH=os.system('which svnlook')* def main(repos, txn): svnlook_cmd = '%s log -t %s %s' % (*SVNLOOK_PATH*, txn, repos) check_msg = os.popen(svnlook_cmd, 'r').readline().rstrip('\n') if len(check_msg) 10: sys.stderr.write

Re: TEST=`which test` equivalent in python?

2009-01-24 Thread Benjamin Kaplan
On Sat, Jan 24, 2009 at 2:03 PM, Jay Jesus Amorin jay.amo...@gmail.comwrote: Hi, Kindly help. import sys, os, string *SVNLOOK_PATH=os.system('which svnlook')* Read the docs on os.system. It returns the program's return code, not the child processes stdout. Use the subprocess module.

Re: TEST=`which test` equivalent in python?

2009-01-24 Thread Gabriel Genellina
En Sat, 24 Jan 2009 17:03:33 -0200, Jay Jesus Amorin jay.amo...@gmail.com escribió: *SVNLOOK_PATH=os.system('which svnlook')* You've been told what's wrong with that. But instead of fixing how to invoke which, use distutils.spawn.find_executable instead: py from distutils.spawn import