title: Python, PyDot and DecisionTree
body: <p>I'm trying to visualize my DecisionTree, but getting the error
  The code is:</p>
  
  <pre><code>X = [i[1:] for i in dataset]#attribute
  y = [i[0] for i in dataset]
  clf = tree.DecisionTreeClassifier()
  
  dot_data = StringIO()
  tree.export_graphviz(clf.fit(train_X, train_y), out_file=dot_data)
  graph = pydot.graph_from_dot_data(dot_data.getvalue())
  graph.write_pdf("tree.pdf")
  </code></pre>
  
  <p>And the error is</p>
  
  <pre><code>Traceback (most recent call last):
  if data.startswith(codecs.BOM_UTF8):
  TypeError: startswith first arg must be str or a tuple of str, not bytes
  </code></pre>
  
  <p>Can anyone explain me whats the problem? Thank you a lot!</p>