Python Forum
reading a file like the unix tail -f command does
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading a file like the unix tail -f command does
#1
i want to have my script read a file that another process may or may not have written more to that file extending its size. in unix, the "tail -f" command does this once it has reached EOF. i want my script to read this way. imagine the script is implementing that "tail -f" command. my script will be doing something different but still needs to continuously read a status file up to the end. what i am worried about is if there is something i need to do for this in the Python I/O logic. once a file being read reaches EOF could Python save the EOF state and give EOF each time the script tries to read that file, even if the underlying file in the system has grown? is there anything in particular my script code needs to do if i use the Python I/O interface or should i just read that file via the unix system I/O interface? this project will only be running on Linux.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
reading a file like the unix tail -f command does - by Skaperen - Mar-29-2024, 07:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  reading and writing a image stored in a file Skaperen 4 2,343 Feb-12-2022, 04:03 AM
Last Post: Skaperen
  reading remote active log file? korenron 3 2,971 Jun-24-2021, 09:07 AM
Last Post: korenron
  reading an f-string from a file Skaperen 4 5,213 Nov-03-2019, 01:59 AM
Last Post: Skaperen
  implement function like tail -F memory777 1 1,604 Oct-21-2019, 03:47 PM
Last Post: Larz60+
  Installed Certificates command file for python 3.7, will it cause problems on mac? CosmicCliff 0 2,026 Mar-05-2019, 07:58 PM
Last Post: CosmicCliff
  unix for the beginning mage (bash basic) metulburr 1 3,466 Nov-26-2017, 05:17 PM
Last Post: heiner55
  Pay what you want - Humble Unix Book Bundle O'Reilly Larz60+ 1 4,261 Dec-03-2016, 02:33 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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