Skip to content

Commit

Permalink
add log file
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiyiyimu committed Mar 28, 2020
1 parent 6933051 commit b061309
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,5 @@ def url():
button_img.grid(row = 6, rowspan = 7, column = 0,sticky = "ws")

root.mainloop()

## pyinstaller -F -w -i icon.ico GUI.py
26 changes: 19 additions & 7 deletions QQ_History.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import hashlib
import sqlite3
import time
import traceback

class QQoutput():
def __init__(self,db,key,mode,s):
Expand Down Expand Up @@ -80,10 +81,10 @@ def message(self,num,mode):
else:
print("error mode")
exit(1)
try:
cursor = self.c.execute(execute)
except:
raise ValueError("QQ号/db地址错误")
#try:
cursor = self.c.execute(execute)
#except:
# raise ValueError("QQ号/db地址错误")
if(self.s != "" and len(self.s)>=5):
self.key = self.decode(cursor)
cursor = self.c.execute(execute)
Expand Down Expand Up @@ -137,6 +138,17 @@ def output(self,num,mode,n1,n2):
return self.key

def main(db, qq, key, msg, n1, n2):
mode = 1
q=QQoutput(db,key,mode,msg)
return q.output(qq, mode, n1, n2)
try:
mode = 1
q=QQoutput(db,key,mode,msg)
return q.output(qq, mode, n1, n2)
except Exception as e:
with open('log.txt', 'w') as f:
f.write(str(e))
f.write(traceback.format_exc())

err_info = repr(e).split(":")[0] == "OperationalError('no such table"
print(err_info)
print(repr(e).split(":")[0])
if(err_info):
raise ValueError("QQ号/db地址错误")

0 comments on commit b061309

Please sign in to comment.