TEST=`which test` equivalent in python?

Jay Jesus Amorin jay.amorin at gmail.com
Sat Jan 24 14:03:33 EST 2009


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 ("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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090125/5ec27aff/attachment.html>


More information about the Python-list mailing list