try except

This commit is contained in:
Justin 2023-09-13 22:34:45 +08:00 committed by GitHub
parent f606ebf886
commit 4c00f3635e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1141,8 +1141,12 @@ class StockTicker():
point_change = False point_change = False
if names: if names:
ticker = coin_info[cb]['name'].upper() try:
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT 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: else:
midFrame = self.textToImage(ticker + '(' + base + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT 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 change = float(info['change']) #TEXT
if names: if names:
ticker = info['name'].upper() #TEXT try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else: else:
ticker = symbol ticker = symbol
@ -6750,7 +6757,10 @@ class StockTicker():
info = active_info[symbol] info = active_info[symbol]
change = float(info['change']) #TEXT change = float(info['change']) #TEXT
if names: if names:
ticker = info['name'].upper() #TEXT try:
ticker = info['name'].upper() #TEXT
except:
ticker = symbol
else: else:
ticker = symbol ticker = symbol
arrow, change = self.getArrow(change) arrow, change = self.getArrow(change)
@ -6819,7 +6829,10 @@ class StockTicker():
info = gainers_info[symbol] info = gainers_info[symbol]
change = float(info['change']) #TEXT change = float(info['change']) #TEXT
if names: if names:
ticker = info['name'] #TEXT try:
ticker = info['name'] #TEXT
except:
ticker = symbol
else: else:
ticker = symbol ticker = symbol
arrow, change = self.getArrow(change) arrow, change = self.getArrow(change)
@ -6888,7 +6901,10 @@ class StockTicker():
info = losers_info[symbol] info = losers_info[symbol]
change = float(info['change']) #TEXT change = float(info['change']) #TEXT
if names: if names:
ticker = info['name'] try:
ticker = info['name']
except:
ticker = symbol
else: else:
ticker = symbol #TEXT ticker = symbol #TEXT
arrow, change = self.getArrow(change) arrow, change = self.getArrow(change)