Fixed exception when log file not available

This commit is contained in:
Oliver Hartmann 2021-05-11 19:33:59 +02:00
parent 12773f1543
commit 00098e3fa6

View File

@ -5,6 +5,7 @@ from .data import log
def read_log(logfile: str, app: gui.Gui) -> None:
try:
logfile = open(logfile, 'r', encoding='utf8')
loglines = follow(logfile)
for line in loglines:
@ -13,6 +14,8 @@ def read_log(logfile: str, app: gui.Gui) -> None:
if message and message.trade and message.to_from == 'From':
log.debug(message.trade)
app.add_tab(30, message)
except IOError:
log.error(f'Error opening log file {logfile}.')
def follow(thefile: str):