-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestsms.py
More file actions
72 lines (61 loc) · 1.48 KB
/
testsms.py
File metadata and controls
72 lines (61 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
import inbox, messaging, e32
import sys, os
try:
raise Exception
except Exception:
mydir = os.path.dirname(sys.exc_info()[2].tb_frame.f_code.co_filename)
if not mydir:
mydir = os.getcwd()
sys.path.append(mydir)
#sys.path.append(u"c:\\Data\\python")
import mktimefix as time
import datetime
import db
limit = 50
txNum = "10657558022909"
if(e32.in_emulator()):
txNum = "700"
def get_period_time_stamp():
t = datetime.datetime.now()
t = t - datetime.timedelta(days = 2)
t = t.replace(hour = 0, minute = 0, second = 0, microsecond = 0)
stamp = time.mktime(t.timetuple())
return stamp
def delete_msg():
stamp = get_period_time_stamp()
inb = inbox.Inbox()
count = 0
i = 0
for id in inb.sms_messages():
if(i > limit):
print "Exceed limit"
break
i+=1
if(inb.address(id) != txNum):
continue
if(inb.time(id) < stamp):
inb.delete(id)
count += 1
return count
try:
print "haha"
print delete_msg()
except:
import sys
import traceback
import appuifw
cla, exc, trbk = sys.exc_info()
excName = cla.__name__
try:
excArgs = exc.args
except KeyError:
excArgs = "<no args>"
excTb = traceback.format_tb(trbk, 5)
errorString = repr(excName) + '-' + repr(excArgs) + '-' + repr(excTb) + '\n'
print errorString
appuifw.note(u'Application errors, see log file for more information', "error")
file = open(u'C:\\Log.txt','a')
file.write(errorString)
file.close()
raise