I'm executing a line of shell script using python. It isn't working with which to test of the existence of homebrew
#!/usr/bin/python
import sys, subprocess
subprocess.call(["which python"])
throws the long error
Traceback (most recent call last):
File "installations.py", line 5, in <module>
subprocess.call(["which python"])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
But I know that the shell execution is working correctly on some level
#!/usr/bin/python
import sys, subprocess
subprocess.call(["whoami])
prints my username just fine. Am I doing something wrong, or is which for some reason not supported. Is there some better supported way of detecting the existence of an installation?