I am trying to run a
cmd = "join <(sort %s) <(sort %s)" % (outfile, filename)
with open(out_temp, 'w') as out:
return_code = subprocess.call(cmd, stdout=out, shell=True)
if return_code != 0:
print "not working!"
/bin/sh: -c: line 0: syntax error near unexpected token `('
["join" , "<(sort" , outfile , ") <(sort" , filename , ")"]
<( is a
bash extension to standard shell syntax. Notice in the error message that it's running
/bin/bash; even if
/bin/sh is a link to
bash drops many of its extensions when it's run using that link.
You can use
bash explicitly with:
cmd = "bash -c 'join <(sort %s) <(sort %s)'" % (outfile, filename)