title: I keep getting an AttributeError: 'str' object has no attribute '__get_author'. Could someone please help me with what I can do to fix it?
body: <p>I am creating a tweet manager and i'm coming upon a attribute error that i honestly don't know how to fix. I am a novice at Python so I'm still learning. Why am I getting AttributeError: 'str' object has no attribute '__get_author'. Here is my code:</p>
  
  <pre><code># The running flag and the tweets list are initialized here
  running = True
  tweets = []
  
  
  # This will function as our main loop
  while(running):
  
      # Get the user's input using the input command to display the menu
      print('Tweet Menu ----------------\n' \
                      '1. Make a Tweet\n' \
                      '2. View Recent Tweets\n' \
                      '3. Search Tweets\n' \
                      '4. Quit\n')
      choice = input('What would you like to do?')
  
      # Make sure the input is an integer
      try:
          value = int(choice)
      except ValueError:
          print("Please enter a numeric value")
          continue
  
      # Handle "Make a Tweet" input
      if value == 1:
          name = str(input('What is your name?'))
          tweeting = True
          while (tweeting):
              message = str(input('What would you like to tweet?'))
              if len(message) &lt; 140:
                  tweet = (name, message)
                  tweets.append(tweet)
                  print(name + ", your tweet has been saved.")
                  tweeting = False
              else:
                  print("Tweets can only be 140 characters!")
  
      # Handle "View Recent Tweets" input
      elif value == 2:
          if len(tweets) == 0:
              print("There are no tweets saved")
          else:
              for i in range(len(tweets)-1, len(tweets) -6, -1):
                  print(tweet[i].__get_author())
                  print(tweet[i].__get_text())
                  print(tweet[i].__get_age())
  
      # Handle "Search Tweets" input
      elif value == 3:
          if len(tweets) == 0:
              print("There are no tweets saved")
          else:
              found = False # A flag to see if we found a matching tweet
              search_key = str(input('What would you like to search for?'))
              for i in range(len(tweets)-1, 0, -1):
                  if search_key in tweets[i].__get_text():
                      print(tweets[i].__get_author())
                      print(tweets[i].__get_text())
                      print(tweets[i].__get_age())
                      found = True
              if found == False:
                  print("No tweets contained " + search_key)
  
      # Handle "Quit" input
      # This is where you'll want to save the tweets to a .dat file
      elif value == 4:
          if len(tweets) &gt; 0:
  
              # SAVE THE TWEETS TO A .DAT FILE HERE
              import pickle
  
              tweets = message
  
              output_file = open('tweets.dat', 'wb')
              pickle.dump(tweets, output_file)
              output_file.close()
  
  
  
  
          print("Thank you for using the Tweet Manager!")
          running = False
  
      # Handle inputs that are not in range 1 to 4 inclusive
      else:
          print("Please select a valid option")
  </code></pre>
  
  <p>The other program i have is Twitter.py which goes hand in hand with this program.
  Here is Twitter.py's code:</p>
  
  <p>import time</p>
  
  <p>class Tweet:
      'Class for a tweet'</p>
  
  <pre><code># init function creates a Tweet
  def __init__(self, author, text):
      self.author = author
      self.text = text
      self.age = time.time()
  
  # returns author of tweet
  def __get_author(self):
      return self.author
  
  # returns text of tweet
  def __get_text(self):
      return self.text
  
  # returns age of tweet in the correct format
  def __get_age(self):
      elapsed = time.time() - self.age
      if elapsed &lt; 60:
          return str(int(elapsed)) + 's'
      elif elapsed/60 &lt; 60:
          return str(int(elapsed/60)) + 'm'
      else:
          return str(int(elapsed/3600)) + 'h'
  </code></pre>