From 4c00f3635eb3cc25ffb2200990027654ee530da1 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 13 Sep 2023 22:34:45 +0800 Subject: [PATCH] try except --- stockTicker.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 32aea9a..08b9dce 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -1141,8 +1141,12 @@ class StockTicker(): point_change = False if names: - ticker = coin_info[cb]['name'].upper() - midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT + try: + ticker = coin_info[cb]['name'].upper() + midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT + except: + ticker, base = cb.split(',') + midFrame = self.textToImage(ticker + '(' + base + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT else: midFrame = self.textToImage(ticker + '(' + base + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT @@ -2117,7 +2121,10 @@ class StockTicker(): change = float(info['change']) #TEXT if names: - ticker = info['name'].upper() #TEXT + try: + ticker = info['name'].upper() #TEXT + except: + ticker = symbol else: ticker = symbol @@ -6750,7 +6757,10 @@ class StockTicker(): info = active_info[symbol] change = float(info['change']) #TEXT if names: - ticker = info['name'].upper() #TEXT + try: + ticker = info['name'].upper() #TEXT + except: + ticker = symbol else: ticker = symbol arrow, change = self.getArrow(change) @@ -6819,7 +6829,10 @@ class StockTicker(): info = gainers_info[symbol] change = float(info['change']) #TEXT if names: - ticker = info['name'] #TEXT + try: + ticker = info['name'] #TEXT + except: + ticker = symbol else: ticker = symbol arrow, change = self.getArrow(change) @@ -6888,7 +6901,10 @@ class StockTicker(): info = losers_info[symbol] change = float(info['change']) #TEXT if names: - ticker = info['name'] + try: + ticker = info['name'] + except: + ticker = symbol else: ticker = symbol #TEXT arrow, change = self.getArrow(change)