how to check something eg java, php, program etc installed with python?
<p>im makeing something like a check system before run so it meets the requirements with python.
heres my code so far;</p>

<pre><code>def checksystem():
    installednode = os.popen('node ' + srctocoffeecompiler + ' -v')
    // version 1.1.1
    print installednode.read()
</code></pre>

<p>i can print the version but <strong>is there a better way to check its installed with a version higher then 1.0.x</strong> ? heres my code so far to do this.</p>

<pre><code>version = installednode.read()
if installednode.read() == 'CoffeeScript version 1.1.1':
    // the code
    // or split the string with space then get the last array
    // check if its more then 1.1.1 or 111 ( dots removed )
</code></pre>

<p>*edit ive read the docs about useing subprocess.Popen, that is maybe better, not sure. im still geting errors <em>no such file exist</em>.</p>

<p>*edit2</p>

<pre><code>pn = subprocess.Popen(['node','-v'], stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE)
print "NodeJS version: " + pn.read()
</code></pre>

<p>ok, somehow i can call it, but i cant read its output return, same with java</p>

<pre><code>pj = subprocess.Popen(['java','-version'], stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE)
print "JAVA: " + pj.read()
</code></pre>

<p>thanks!</p>
