def kpsewhich(filename):
 try:
  find_cmd('kpsewhich')
  proc = subprocess.Popen(['kpsewhich', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  (stdout, stderr) = proc.communicate()
  return stdout.strip().decode('utf8', 'replace')
 except FindCmdError:
  pass

def kpsewhich ( filename ) : try : find_cmd ( 'kpsewhich' ) proc = subprocess . Popen ( [ 'kpsewhich' , filename ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( stdout , stderr ) = proc . communicate ( ) return stdout . strip ( ) . decode ( 'utf8' , 'replace' ) except FindCmdError : pass
invoke kpsewhich command with an argument filename .