On Sat, Jan 24, 2009 at 2:03 PM, Jay Jesus Amorin <jay.amo...@gmail.com>wrote:
> 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. > > > 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') os.popen does what you want here, but it is deprecated in favor of the more powerful subprocess module. > > > if len(check_msg) < 10: > sys.stderr.write ("Blahh Blahh....\n") > sys.exit(1) > else: > sys.exit(0) > > if __name__ == '__main__': > if len(sys.argv) < 3: > sys.stderr.write("Usage: %s REPOS TXN\n" % (sys.argv[0])) > else: > main(sys.argv[1], sys.argv[2]) > > > The SVNLOOK_PATH is not working and python says its null when run as SVN > hook-script. Do I need to load the os environment variable? How do i pass > the value of 'which svnlook' to SVNLOOK_PATH variable. > > Thanks for your help. > > > Jay > > -- > http://mail.python.org/mailman/listinfo/python-list > >
-- http://mail.python.org/mailman/listinfo/python-list