I am writing a csv file in one program. It will append the output file every 15 minutes. I want to read all the content of the output file till it stops writing. I want another program to wait for 30 minutes if no change in the output file then stop reading. Alternatively how to read it with csv package?
# File Writing
csvfile = open(output_file_name, 'a')
csvwriter = csv.writer(csvfile, delimiter=',', quotechar = '"')
# Some logic
csvwriter.writerow(data)
....
# finally close file
csvfile.close()
# File Reading
for df in pd.read_csv(output_file_name, chunksize=1000):
# Some logic
...
Currently File can read upto what it has written to the output_file before start reading. Changes done to the output files are discarded while reading output_file file at the same time.