I am new to python and just been playing with the database API. I am getting an invalid syntax error in the exception except block comma. I can't figure out any syntax mistakes. Below is the code I am using
import time
import MySQLdb
import sys
import urllib2
#f = open("../", 'r')
try:
db = MySQLdb.connect(host="localhost", user="test", passwd="test",db="test")
cur = db.cursor()
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit (1)
finally:
cur.close()
db.close()
#f.write('amal')
#f.close()
except MySQLdb.Error as e:.