improved exception handling
This commit is contained in:
parent
21c59656a3
commit
2f08c5529a
|
@ -394,10 +394,10 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
JpegData = buffer.data()
|
JpegData = buffer.data()
|
||||||
self.wfile.write("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
|
self.wfile.write("--aaboundary\r\nContent-Type: image/jpeg\r\nContent-length: %d\r\n\r\n%s\r\n\r\n\r\n" % (len(JpegData), JpegData))
|
||||||
|
|
||||||
del JpegData
|
JpegData = None
|
||||||
del buffer
|
buffer = None
|
||||||
del img
|
img = None
|
||||||
del exporter
|
exporter = None
|
||||||
#now = time.time()
|
#now = time.time()
|
||||||
#dt = now - lastTime
|
#dt = now - lastTime
|
||||||
#lastTime = now
|
#lastTime = now
|
||||||
|
@ -418,18 +418,18 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
except (KeyboardInterrupt, SystemError):
|
except (KeyboardInterrupt, SystemError):
|
||||||
print "queue size", queue.qsize()
|
print "queue size", queue.qsize()
|
||||||
if hasattr(self, "thread"):
|
if hasattr(self, "thread") and self.thread is not None:
|
||||||
self.thread.running = False
|
self.thread.running = False
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
del self.thread
|
self.thread = None
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
print "ioerror", e, e[0]
|
print "ioerror", e, e[0]
|
||||||
print dir(e)
|
print dir(e)
|
||||||
if e[0] == 32:
|
if e[0] in (32, 104):
|
||||||
if hasattr(self, "thread"):
|
if hasattr(self, "thread") and self.thread is not None:
|
||||||
self.thread.running = False
|
self.thread.running = False
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
del self.thread
|
self.thread = None
|
||||||
else:
|
else:
|
||||||
print '-'*40
|
print '-'*40
|
||||||
print 'Exception happened during processing of request from'
|
print 'Exception happened during processing of request from'
|
||||||
|
|
Loading…
Reference in New Issue