Fixed exception when log file not available
This commit is contained in:
parent
12773f1543
commit
00098e3fa6
@ -5,14 +5,17 @@ from .data import log
|
|||||||
|
|
||||||
|
|
||||||
def read_log(logfile: str, app: gui.Gui) -> None:
|
def read_log(logfile: str, app: gui.Gui) -> None:
|
||||||
logfile = open(logfile, 'r', encoding='utf8')
|
try:
|
||||||
loglines = follow(logfile)
|
logfile = open(logfile, 'r', encoding='utf8')
|
||||||
for line in loglines:
|
loglines = follow(logfile)
|
||||||
message = Message.from_text(line)
|
for line in loglines:
|
||||||
log.debug(message)
|
message = Message.from_text(line)
|
||||||
if message and message.trade and message.to_from == 'From':
|
log.debug(message)
|
||||||
log.debug(message.trade)
|
if message and message.trade and message.to_from == 'From':
|
||||||
app.add_tab(30, message)
|
log.debug(message.trade)
|
||||||
|
app.add_tab(30, message)
|
||||||
|
except IOError:
|
||||||
|
log.error(f'Error opening log file {logfile}.')
|
||||||
|
|
||||||
|
|
||||||
def follow(thefile: str):
|
def follow(thefile: str):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user