from Lite SQL database

#!/usr/bin/python
# -*- coding: utf-8 -*-

import sqlite3 as lite
import os, csv, sys, subprocess, hashlib, time
from datetime import timedelta, datetime, tzinfo
import platform

con = lite.connect('files.db')
con.text_factory = str
with con:
    for directory, subdirectories, filenames in os.walk('.'):
        print(directory);
        cur = con.cursor()    
        cur.execute("SELECT * FROM data where path=:directory COLLATE NOCASE", {"directory":directory})
        con.commit()
        row = cur.fetchone()
        if row == None:
            text_file = open("err_log.txt", "a")
            text_file.write(directory+"\n")
            text_file.close()
        else:
            #cts = float(abs(row[1]))
            mts = float("0" + abs(row[2])
            if mts < 0:
                mts = float("0" + abs(row[1])
            os.utime(directory,(mts,mts))    
            #print row[0], row[1], row[2]
        for filename in filenames:
            full_filename = os.path.join(directory, filename)
            print full_filename;
            cur.execute("SELECT * FROM data where path=:full_filename COLLATE NOCASE", {"full_filename":full_filename})
            con.commit()
            row = cur.fetchone()
            if row == None:
                text_file = open("err_log.txt", "a")
                text_file.write(full_filename+"\n")
                text_file.close()
            else:
                #cts = float(abs(row[1]))
                mts = float("0" + abs(row[2])
                if mts < 0:
                    mts = float("0" + abs(row[1])
                os.utime(full_filename,(mts,mts))