Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
some logic help
#6
(Jun-11-2023, 09:28 AM)Gribouillis Wrote: You can also replace
for last_line in file:
    pass
with
import io
file.seek(0, io.SEEK_END) # go directly to the end of the file

Thank you for this, it worked! For some reason, the other one was not pulling the newest line file, and the variable was never getting updated. Over, and over, and over again, new_line was set to: "[!] This is the line that was checked for error: Jun 11 06:46:35 NUT upsmon[516]: Poll UPS [apc1500@localhost] failed - Driver not connected" even though that was not the most recent entry, and things were now working fine.
Reply


Messages In This Thread
some logic help - by droidus - Jun-10-2023, 05:34 PM
RE: some logic help - by deanhystad - Jun-10-2023, 08:53 PM
RE: some logic help - by droidus - Jun-10-2023, 11:34 PM
RE: some logic help - by deanhystad - Jun-11-2023, 07:55 AM
RE: some logic help - by Gribouillis - Jun-11-2023, 09:28 AM
RE: some logic help - by droidus - Jun-11-2023, 10:41 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020