Skip to content

Commit c947836

Browse files
committed
Exception explanation + data URI logging
1 parent 8292d1f commit c947836

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

HistoryAnalyzer.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def parse(url):
1111
domain = sublevel_split[0].replace("www.", "")
1212
return domain
1313
except IndexError:
14-
print "URL format error!"
14+
print "URL format error! url = {}".format(url)
1515

1616
def analyze(results):
1717

@@ -45,8 +45,12 @@ def analyze(results):
4545
#print cursor.fetchall()
4646

4747
#url and visit counts
48-
select_statement = "SELECT urls.url, urls.visit_count FROM urls, visits WHERE urls.id = visits.url;"
49-
cursor.execute(select_statement)
48+
try:
49+
select_statement = "SELECT urls.url, urls.visit_count FROM urls, visits WHERE urls.id = visits.url;"
50+
cursor.execute(select_statement)
51+
except sqlite3.OperationalError:
52+
print "[!] The database is locked! Please exit Chrome and run the script again."
53+
quit()
5054

5155
results = cursor.fetchall() #tuple
5256

0 commit comments

Comments
 (0)