6
6
# Authors: Renze Nicolai <renze@rnplus.nl>
7
7
# Thomas Roos <?>
8
8
9
- import uos , ujson , easywifi , easyrtc , time , appglue , deepsleep , ugfx , badge , machine
9
+ import uos , ujson , easywifi , easyrtc , time , appglue , deepsleep , ugfx , badge , machine , sys
10
10
11
11
services = [] #List containing all the service objects
12
12
loopCallbacks = {} #Dict containing: {<FUNCTION>:<Wifi required on next run>}
@@ -85,8 +85,9 @@ def setup(pmCb=None, drawCb=None):
85
85
# Import the service.py script
86
86
try :
87
87
srv = __import__ ('lib/' + app + '/service' )
88
- except BaseException as msg :
89
- print ("[SERVICES] Could not import service of app " + app + ": " , msg )
88
+ except BaseException as e :
89
+ print ("[SERVICES] Could not import service of app " + app + ": " )
90
+ sys .print_exception (e )
90
91
continue #Skip the app
91
92
92
93
if wifiInSetup :
@@ -109,8 +110,9 @@ def setup(pmCb=None, drawCb=None):
109
110
110
111
try :
111
112
srv .setup ()
112
- except BaseException as msg :
113
- print ("[SERVICES] Exception in service setup " + app + ": " , msg )
113
+ except BaseException as e :
114
+ print ("[SERVICES] Exception in service setup " + app + ":" )
115
+ sys .print_exception (e )
114
116
continue
115
117
116
118
if loopEnabled :
@@ -157,8 +159,9 @@ def loop_timer():
157
159
rqi = 0
158
160
try :
159
161
rqi = cb ()
160
- except BaseException as msg :
161
- print ("[SERVICES] Exception in service loop: " , msg )
162
+ except BaseException as e :
163
+ print ("[SERVICES] Exception in service loop:" )
164
+ sys .print_exception (e )
162
165
newLoopCallbacks .pop (cb )
163
166
continue
164
167
if rqi > 0 and rqi < requestedInterval :
@@ -200,8 +203,9 @@ def draw_timer():
200
203
try :
201
204
[rqi , space_used ] = cb (y )
202
205
y = y - space_used
203
- except BaseException as msg :
204
- print ("[SERVICES] Exception in service draw: " , msg )
206
+ except BaseException as e :
207
+ print ("[SERVICES] Exception in service draw:" )
208
+ sys .print_exception (e )
205
209
newDrawCallbacks .pop (i )
206
210
continue
207
211
if rqi > 0 and rqi < requestedInterval :
@@ -242,5 +246,6 @@ def force_draw(disableTimer):
242
246
try :
243
247
[rqi , space_used ] = cb (y )
244
248
y = y - space_used
245
- except BaseException as msg :
246
- print ("[SERVICES] Exception in service draw: " , msg )
249
+ except BaseException as e :
250
+ print ("[SERVICES] Exception in service draw: " )
251
+ sys .print_exception (e )
0 commit comments