title: Python Element Tree Writing to New File
body: <p>Hi so I've been struggling with this and can't quite figure out why I'm getting errors. Trying to export just some basic XML into a new file, keeps giving me a TypeError. Below is a small sample of the code</p>
  
  <pre><code>from xml.etree.ElementTree import ElementTree
  from xml.etree.ElementTree import Element
  from xml.etree.ElementTree import SubElement
  import xml.etree.ElementTree as ET
  
  
  root = Element('QuoteWerksXML')
  tree = ElementTree(root)
  ver = SubElement(root, "AppVersionMajor")
  ver.text = '5.1'
  
  tree.write(open('person.xml', 'w'))
  </code></pre>