im makeing something like a check system before run so it meets the requirements with python. heres my code so far;
def checksystem():
installednode = os.popen('node ' + srctocoffeecompiler + ' -v')
// version 1.1.1
print installednode.read()
i can print the version but is there a better way to check its installed with a version higher then 1.0.x ? heres my code so far to do this.
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 )
*edit ive read the docs about useing subprocess.Popen, that is maybe better, not sure. im still geting errors no such file exist.
*edit2
pn = subprocess.Popen(['node','-v'], stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE)
print "NodeJS version: " + pn.read()
ok, somehow i can call it, but i cant read its output return, same with java
pj = subprocess.Popen(['java','-version'], stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE)
print "JAVA: " + pj.read()
thanks!