title: Python AttributeError: class object has no attribute
body: <p>When I try to run the code of a class I'm writing, I get an <code>AttributeError</code> and I'm not sure why. The specific error is as follows:</p>
  
  <pre><code>    self.marker = self.markers[marker[1:]]
  AttributeError: 'TTYFigureData' object has no attribute 'markers'
  </code></pre>
  
  <p>Here is part of the class I'm writing:</p>
  
  <pre><code>class TTYFigureData(object):
      """
      data container of TTYFigure
      """
      def __init__(
          self,
          x,                      # x values
          y,                      # y values
          marker          = "_.", # datum marker
          plot_slope      = True
          ):
          self.x          = x
          self.y          = y
          self.plot_slope = plot_slope
          self.set_marker(marker)
          self.markers = {
              "-" : u"None" ,
              "," : u"\u2219"
          }
  
      def set_marker(
          self,
          marker
          ):
          if marker in [None, "None", u"None", ""]:
              self.plot_slope = True
              self.marker = ""
          elif marker[0] == "_":
              self.marker = self.markers[marker[1:]]
          else:
              self.marker = marker
  </code></pre>
  
  <p>Where am I going wrong?</p>