title: Script - Check CPU load (Python)
body: <p>I've written for practicing purposes the following python script which checks the cpu load in case the processor reaches the 50% of the total usage.</p>
  
  <pre><code>import subprocess
  import os
  
  process1 = os.popen('cat /proc/cpuinfo | grep -c processor')
  cmdread1 = process1.read()
  process1.close()
  num_of_procs = int(cmdread1)/2
  print num_of_procs    # returns 1
  
  process = os.popen('cat /proc/loadavg | awk \'{print $1}\'')
  cmdread = process.read()
  process.close()
  cpu_usage = cmdread
  print cpu_usage   # returns 0.15 or 0.xx (there is no load at the moment)
  if cpu_usage&gt;num_of_procs: # check if 0.15 is greater than 1 
     print "load!"
  else:
     print "no load"
  </code></pre>
  
  <p>The script always returns "load" which is false.
  Moreover , I've check the boolean operations between a float and an integer and i see not something weird.
  Do you have any idea ? Thanks in advance.</p>