title: Why do I keep getting redirection unexpected error python?
body: <p>I am trying to run a program from within Python and redirect that output to a new file that I will read into another program later. Is there some other way I should be doing this other than "%s>%s"?</p>
  
  <pre><code>distmathandle = open("newfile.distmat", "w")
  cmd = "quicktree -out m %s&gt;%s" % (stfname,distmathandle)
  sys.stderr.write("command: %s\n" %cmd)
  os.system(cmd)
  sys.stderr.write("command done\n")
  distmathandle.close()
  </code></pre>