title: Python Mysql TypeError: 'NoneType' object is not subscriptable
body: <pre><code>conn = MySQLdb.connect (host = "localhost", user="root", passwd="xxxx", db="xxxxx")
       cursor = conn.cursor()
       cursor.execute ("SELECT * FROM pin WHERE active=1")
       while (1):
         row = cursor.fetchone()
         st = str(row[2])
         pin = str(row[1])
         order = str(st)+str(pin)
         if row == None:
            break
         sendSerial(order)
  conn.close()
  </code></pre>
  
  <p>Why st = str(row[2]) become error? 
  How should retrieve rows from the database into a variable?</p>
  
  <p>Thank You for your answer.</p>