def main():
from time import sleep,perf_counter
from keyboard import is_pressed,send,write
from random import choice
slp,getTime,isp,snd,wrt,chc = sleep,perf_counter,is_pressed,send,write,choice
logpath = "C:/Users/USER/AppData/Roaming/.minecraft/logs/latest.log"
with open(logpath,"r") as file:
backloglength = len(file.readlines())
def getLastMessages():
global backloglength
with open(logpath,"r") as file:
temp = file.readlines()
out = [temp for i in range(backloglength,len(temp))]
backloglength = len(temp)
return out
while True:
start = getTime()+3
print(getLastMessages())
while getTime() < start: pass
main() пишет ошибку
out = [temp for i in range(backloglength,len(temp))]
^^^^^^^^^^^^^
NameError: name 'backloglength' is not defined
откуда эта ошибка? переменная backloglength существует
from time import sleep,perf_counter
from keyboard import is_pressed,send,write
from random import choice
slp,getTime,isp,snd,wrt,chc = sleep,perf_counter,is_pressed,send,write,choice
logpath = "C:/Users/USER/AppData/Roaming/.minecraft/logs/latest.log"
with open(logpath,"r") as file:
backloglength = len(file.readlines())
def getLastMessages():
global backloglength
with open(logpath,"r") as file:
temp = file.readlines()
out = [temp for i in range(backloglength,len(temp))]
backloglength = len(temp)
return out
while True:
start = getTime()+3
print(getLastMessages())
while getTime() < start: pass
main() пишет ошибку
out = [temp for i in range(backloglength,len(temp))]
^^^^^^^^^^^^^
NameError: name 'backloglength' is not defined
откуда эта ошибка? переменная backloglength существует