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:
try:
ticker = coin_info[cb]['name'].upper() ticker = coin_info[cb]['name'].upper()
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT 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:
try:
ticker = info['name'].upper() #TEXT 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:
try:
ticker = info['name'].upper() #TEXT 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:
try:
ticker = info['name'] #TEXT 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:
try:
ticker = info['name'] ticker = info['name']
except:
ticker = symbol
else: else:
ticker = symbol #TEXT ticker = symbol #TEXT
arrow, change = self.getArrow(change) arrow, change = self.getArrow(change)