def read_pid_from_pidfile(pidfile_path):
 pid = None
 try:
  pidfile = open(pidfile_path, 'r')
 except IOError:
  pass
 else:
  line = pidfile.readline().strip()
  try:
   pid = int(line)
  except ValueError:
   pass
  pidfile.close()
 return pid

def read_pid_from_pidfile ( pidfile_path ) : pid = None try : pidfile = open ( pidfile_path , 'r' ) except IOError : pass else : line = pidfile . readline ( ) . strip ( ) try : pid = int ( line ) except ValueError : pass pidfile . close ( ) return pid
read the pid recorded in the named pid file .