I am fairly new to python and am writing a code to read imagery and insert them into an SQLite database but I get the following error
cur.execute(statement, (index,fullpath,filename)) sqlite3.OperationalError: near "index": syntax error.
What is it that I am getting wrong? The following is the code:
for root, dirnames, filenames in os.walk(basedir): print 'root is ' + root for filename in filenames: ext = os.path.splitext(filename).lower() #extension as lowercase if ext == extension: index = filename[:9] #tile ID filebase = os.path.splitext(filename) #first part of filename fullpath = os.path.join(root,filebase) + ext #build up path again statement = "INSERT INTO %s (%s) VALUES " % (table,columns) + "(%s,%s,%s);" cur.execute(statement, (index,fullpath,filename)) print 'catalog entry: ' + index + ', ' + fullpath