From e95c854b7920613d7452bf635bfcb8cd5ff231b9 Mon Sep 17 00:00:00 2001 From: Neythen Treloar <33317183+zcqsntr@users.noreply.github.com> Date: Mon, 4 Apr 2022 18:19:23 +0100 Subject: [PATCH] Update stockTicker.py black screen bug test --- stockTicker.py | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index b4e3520..c05b122 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -286,7 +286,7 @@ class StockTicker(): return kill def updateMultiple(self, options): - print('options', options) + for option in options: @@ -344,7 +344,9 @@ class StockTicker(): update_process = Process(target = self.updateMultiple, args = ([options[(i+1) % len(options)]],)) update_process.start() - settings = json.load(open(self.JSONs[options[(i) % len(options)]])) + f = open(self.JSONs[options[(i) % len(options)]]) + settings = json.load(f) + f.close() self.set_delay(settings['speed']) animation = settings['animation'].lower() @@ -970,14 +972,14 @@ class StockTicker(): image_list.append(self.blank) except Exception as e: - - exc_type, exc_obj, exc_tb = sys.exc_info() - fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] - self.logf.write(str(e)) - self.logf.write('. file: ' + fname) - self.logf.write('. line: ' + str(exc_tb.tb_lineno)) - self.logf.write('. type: ' + str(exc_type)) - self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) + pass + #exc_type, exc_obj, exc_tb = sys.exc_info() + #fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + #self.logf.write(str(e)) + #self.logf.write('. file: ' + fname) + #self.logf.write('. line: ' + str(exc_tb.tb_lineno)) + #self.logf.write('. type: ' + str(exc_type)) + #self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) finalDisplayImage = self.stitchImage(image_list) @@ -1256,7 +1258,7 @@ class StockTicker(): percent_change = '%.2f' % abs(float(info['percent_change'])) + '%' point_change = '%.2f' % abs(change) - print(percent_change, point_change) + current = '%.2f' % float(info['current']) #TEXT @@ -1279,7 +1281,7 @@ class StockTicker(): logo = self.openImage(os.path.join(logos_path, ticker + '.png')) stitchedStock = self.stitchImage([logo,midFrame]) except Exception as e: - print(str(e)) + stitchedStock = midFrame else: stitchedStock = midFrame @@ -1289,13 +1291,14 @@ class StockTicker(): image_list.append(self.blank) except Exception as e: - exc_type, exc_obj, exc_tb = sys.exc_info() - fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] - self.logf.write(str(e)) - self.logf.write('. file: ' + fname) - self.logf.write('. line: ' + str(exc_tb.tb_lineno)) - self.logf.write('. type: ' + str(exc_type)) - self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) + pass + #exc_type, exc_obj, exc_tb = sys.exc_info() + #fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] + #self.logf.write(str(e)) + #self.logf.write('. file: ' + fname) + #self.logf.write('. line: ' + str(exc_tb.tb_lineno)) + #self.logf.write('. type: ' + str(exc_type)) + #self.logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) @@ -2777,7 +2780,7 @@ if __name__ == '__main__': msg = getInput() stock_ticker.process_msg(msg) except Exception as e: - print(str(e)) + #print(str(e)) exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]