From 2855d59572fa07617ed3c60690984b421bb0b9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Thu, 27 Mar 2014 14:10:26 +0100 Subject: [PATCH] fixed minor issues in ekgplotter --- ekgplotter/ekgplotter/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ekgplotter/ekgplotter/main.py b/ekgplotter/ekgplotter/main.py index 5c8335e..778700d 100644 --- a/ekgplotter/ekgplotter/main.py +++ b/ekgplotter/ekgplotter/main.py @@ -336,8 +336,9 @@ class EkgPlot(object): class MyHandler(BaseHTTPRequestHandler): def __del__(self): - self.thread.running = False - self.thread.join() + if hasattr(self, "thread"): + self.thread.running = False + self.thread.join() def do_GET(self): @@ -406,12 +407,12 @@ class MyHandler(BaseHTTPRequestHandler): #print '%0.2f fps' % fps elif self.path.endswith(".jpeg"): - f = open(curdir + sep + self.path) + directory = os.path.dirname(os.path.abspath(__file__)) + data = open(os.path.join(directory, self.path), "rb").read() self.send_response(200) self.send_header('Content-type','image/jpeg') self.end_headers() - self.wfile.write(f.read()) - f.close() + self.wfile.write(data) return except (KeyboardInterrupt, SystemError): print "queue size", queue.qsize()