I think i figured out the problem.
Before solution, here is how my lb and cmd looks
lb = '\"lbtype(%s-%s)\"' % (tmp_prod_no, rev)
cmd = [clt, 'find', lm_path, '-follow', '-name', '\"*.elf\"', '-version', lb, "-print"]
\" tags are the culprit for the problem
After following modifications (lb and *.elf), it works fine
lb = 'lbtype(%s-%s)' % (tmp_prod_no, rev)
cmd = [clt, 'find', lm_path, '-follow', '-name', '*.elf', '-version', lb, "-print"]
Can some one explain how subprocess deal with quotes in command.
Here are different combinations i tried and the errors
Case 1 - Double quotes for lb and elf
lb = '\"lbtype(%s-%s)\"' % (tmp_prod_no, rev)
cmd = [clt, 'find', lm_path, '-follow', '-name', '\"*.elf\"', '-version', lb, "-print"]
o/p:
--b''--
===DONE===
Case 2 - Double quotes for elf
lb = 'lbtype(%s-%s)' % (tmp_prod_no, rev)
cmd = [clt, 'find', lm_path, '-follow', '-name', '\"*.elf\"', '-version', lb, "-print"]
o/p:
cleartool: Error: Syntax error in query (near character 1).
cleartool: Error: Invalid query: ""lbtype(CXC1727075-R78A12)""
cleartool: Warning: Skipping \vobs/cello/babs/control_test_dm/jpre_test_lm/bin/jpre_test.ppc.elf".
CALLEDPROCESSERROR
Command '['/usr/atria/bin/cleartool', 'find', '/vobs/cello/babs/control_test_dm/jpre_test_lm', '-follow', '-name', '*.elf', '-version', '"lbtype(CXC1727075-R78A12)"', '-print']' returned non-zero exit status 1
Case 3 - No Double quotes gives correct answer
lb = 'lbtype(%s-%s)' % (tmp_prod_no, rev)
cmd = [clt, 'find', lm_path, '-follow', '-name', '*.elf', '-version', lb, "-print"]
o/p:
--b'\vobs\asd\asd\adasd'--
===DONE===
Why the clearcase complaining about lbtype in Case 2 but not in Case 1.