fixed some warnings in trade.py
This commit is contained in:
parent
e48abb9820
commit
0c4054d94f
@ -2,12 +2,13 @@ import time
|
|||||||
from .data import Message
|
from .data import Message
|
||||||
from . import gui
|
from . import gui
|
||||||
from .data import log
|
from .data import log
|
||||||
|
from io import TextIOWrapper
|
||||||
|
|
||||||
|
|
||||||
def read_log(logfile: str, app: gui.Gui) -> None:
|
def read_log(logfile: str, app: gui.Gui) -> None:
|
||||||
try:
|
try:
|
||||||
logfile = open(logfile, 'r', encoding='utf8')
|
with open(logfile, 'r', encoding='utf8') as file:
|
||||||
loglines = follow(logfile)
|
loglines = follow(file)
|
||||||
for line in loglines:
|
for line in loglines:
|
||||||
message = Message.from_text(line)
|
message = Message.from_text(line)
|
||||||
log.debug(message)
|
log.debug(message)
|
||||||
@ -18,7 +19,7 @@ def read_log(logfile: str, app: gui.Gui) -> None:
|
|||||||
log.error(f'Error opening log file {logfile}.')
|
log.error(f'Error opening log file {logfile}.')
|
||||||
|
|
||||||
|
|
||||||
def follow(thefile: str):
|
def follow(thefile: TextIOWrapper):
|
||||||
thefile.seek(0, 2)
|
thefile.seek(0, 2)
|
||||||
while True:
|
while True:
|
||||||
line = thefile.readline()
|
line = thefile.readline()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user