Fixed exception when log file not available
This commit is contained in:
parent
12773f1543
commit
00098e3fa6
@ -5,6 +5,7 @@ from .data import log
|
|||||||
|
|
||||||
|
|
||||||
def read_log(logfile: str, app: gui.Gui) -> None:
|
def read_log(logfile: str, app: gui.Gui) -> None:
|
||||||
|
try:
|
||||||
logfile = open(logfile, 'r', encoding='utf8')
|
logfile = open(logfile, 'r', encoding='utf8')
|
||||||
loglines = follow(logfile)
|
loglines = follow(logfile)
|
||||||
for line in loglines:
|
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':
|
if message and message.trade and message.to_from == 'From':
|
||||||
log.debug(message.trade)
|
log.debug(message.trade)
|
||||||
app.add_tab(30, message)
|
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