improved performance but no log tracking

This commit is contained in:
Justin 2022-06-20 17:42:10 +08:00 committed by GitHub
parent 75301ea325
commit d0208cf5f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -974,16 +974,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
@ -1051,15 +1051,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
self.blank = Image.new('RGB', (10, 32)) self.blank = Image.new('RGB', (10, 32))
@ -1133,16 +1134,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
@ -1227,15 +1228,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
@ -1307,29 +1309,31 @@ class StockTicker():
image_list.append(new_im) image_list.append(new_im)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
image_list.append(midFrame) image_list.append(midFrame)
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
@ -1400,30 +1404,32 @@ class StockTicker():
image_list.append(new_im) image_list.append(new_im)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
image_list.append(midFrame) image_list.append(midFrame)
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
self.blank = Image.new('RGB', (10, 32)) self.blank = Image.new('RGB', (10, 32))
@ -1495,16 +1501,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
@ -1582,15 +1588,16 @@ class StockTicker():
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
finalDisplayImage = self.stitchImage(image_list) finalDisplayImage = self.stitchImage(image_list)
@ -1668,15 +1675,16 @@ class StockTicker():
image_list.append(img) image_list.append(img)
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
news_image = self.stitchImage(image_list) news_image = self.stitchImage(image_list)
return news_image return news_image
@ -1757,15 +1765,16 @@ class StockTicker():
image_list.append(img) image_list.append(img)
image_list.append(blank) image_list.append(blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
news_image = self.stitchImage(image_list) news_image = self.stitchImage(image_list)
return news_image return news_image
@ -1917,16 +1926,16 @@ class StockTicker():
img = img.crop((0,0,x_offset ,32)) img = img.crop((0,0,x_offset ,32))
imgs.append(img) imgs.append(img)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
@ -1986,16 +1995,16 @@ class StockTicker():
img.paste(logo, (x_offset, 0)) img.paste(logo, (x_offset, 0))
x_offset += logo.size[0] + 2 x_offset += logo.size[0] + 2
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
name_timage = self.textImage(team['name'], med_font, r = 255, g = 255, b = 0) name_timage = self.textImage(team['name'], med_font, r = 255, g = 255, b = 0)
@ -2027,16 +2036,16 @@ class StockTicker():
img = img.crop((0,0,x_offset ,32)) img = img.crop((0,0,x_offset ,32))
imgs.append(img) imgs.append(img)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
return self.stitchImage(imgs) return self.stitchImage(imgs)
def convertTemp(self,temp, setting): def convertTemp(self,temp, setting):
if setting == 'kelvin': if setting == 'kelvin':
@ -2181,15 +2190,16 @@ class StockTicker():
imgs.append(img) imgs.append(img)
imgs.append(self.blank) imgs.append(self.blank)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
return self.stitchImage(imgs) return self.stitchImage(imgs)
@ -2328,16 +2338,16 @@ class StockTicker():
image_list.append(img) image_list.append(img)
except Exception as e: except Exception as e:
pass
logf = open('log.txt', "a") # logf = open('log.txt', "a")
exc_type, exc_obj, exc_tb = sys.exc_info() # exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e)) # logf.write(str(e))
logf.write('. file: ' + fname) # logf.write('. file: ' + fname)
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('. type: ' + str(exc_type)) # logf.write('. type: ' + str(exc_type))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
logf.close() # logf.close()
return self.stitchImage(image_list) return self.stitchImage(image_list)
def getDailyWeatherImageAlt(self): def getDailyWeatherImageAlt(self):
@ -2681,15 +2691,16 @@ class StockTicker():
imgs.append(self.blank) imgs.append(self.blank)
# add the image text # add the image text
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
return self.stitchImage(imgs) return self.stitchImage(imgs)
@ -2768,15 +2779,16 @@ class StockTicker():
imgs.append(img) imgs.append(img)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
return imgs return imgs
@ -2822,15 +2834,16 @@ class StockTicker():
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()
#below code stitches title and GIF together #below code stitches title and GIF together
@ -3007,15 +3020,16 @@ if __name__ == '__main__':
msg = getInput() msg = getInput()
stock_ticker.process_msg(msg) stock_ticker.process_msg(msg)
except Exception as e: except Exception as e:
logf = open('log.txt', "a") pass
exc_type, exc_obj, exc_tb = sys.exc_info() # logf = open('log.txt', "a")
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] # exc_type, exc_obj, exc_tb = sys.exc_info()
logf.write(str(e)) # fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write('. file: ' + fname) # logf.write(str(e))
logf.write('. line: ' + str(exc_tb.tb_lineno)) # logf.write('. file: ' + fname)
logf.write('. type: ' + str(exc_type)) # logf.write('. line: ' + str(exc_tb.tb_lineno))
logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) # logf.write('. type: ' + str(exc_type))
logf.close() # logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2])))
# logf.close()