title: Python Try: Syntax Error
body: <p>I'm trying to set up a python program to edit a database from input from my arduino, and the <code>try:</code> command is giving me an error and I'm not sure I understand why</p>
  
  <pre><code>import serial
  import MySQLdb
  
  dbConn = MySQLdb.connect("localhost","root","Mecool100","ISEF_DB") or die ("Could not connect to database")
  cursor = dbConn.cursor()
  
  device = '/dev/ttyACM0'
  
  try:
      print "Trying...",device
      arduino = serial.Serial(device, 250000)
  except:
      print "Failed to connect on",device
  
  try:
      data = arduino.readline() #read data
      pieces = data.split("\t")
  
  try:
      cursor.execute("UPDATE `ISEF_DB`.`attendance` SET `present`='1' WHERE `id` = data”)
      dbConn.commit()
      cursor.close()
  except MySQLdb.IntegrityError:
      print "Failed to insert data"
  finally:
      cursor.close()
  except:
      print "Failed to get data"
  </code></pre>
  
  <p>This code is returning the following error:</p>
  
  <pre><code>  File "test.py", line 21
      try:
        ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Could someone please assist me in finding my error?</p>
  
  <p>Thank you :)</p>