Python Forum
How to check if a file has finished being written
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check if a file has finished being written
#1
I have a programme that writes an mtx file to a specified directory on my laptop. It's a very large file (~400,000 KB) and so takes quite some time to finish being written. The next block in my code is dependent on the mtx file being fully written but proceeds to execute once the mtx file first appears in the directory. I had used:
time.sleep(120)
between the two blocks to ensure the file was fully written, but I want a more robust way of checking as this sleep time may not always work. Any ideas on how to check that the file has finished being written? I've had a look at the watchdog module but I can't wrap my head around the syntax. Thank you.
Reply


Messages In This Thread
How to check if a file has finished being written - by leocsmith - Apr-14-2021, 10:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  please check this i wanna use a csv file as a graph xCj11 5 1,515 Aug-25-2022, 08:19 PM
Last Post: deanhystad
  Process finished with exit code 137 (interrupted by signal 9: SIGKILL) erdemath 2 9,595 Apr-18-2022, 08:40 PM
Last Post: erdemath
  check if a file exist on the internet and get the size kucingkembar 6 1,823 Apr-16-2022, 05:09 PM
Last Post: kucingkembar
  Code to check folder and sub folders for new file and alert fioranosnake 2 1,961 Jan-06-2022, 05:03 PM
Last Post: deanhystad
  Using .hdf5 files only once they are finished writing pyhill00 7 2,825 Nov-25-2021, 06:01 PM
Last Post: pyhill00
  Check last time file was accessed Pavel_47 4 2,857 Jun-01-2021, 05:47 PM
Last Post: Yoriz
  Check if a file exists. Pedroski55 5 3,336 Sep-08-2020, 10:01 AM
Last Post: Pedroski55
  process finished with exit code -1073741819 (0xC0000005) GMCobraz 8 5,484 Sep-01-2020, 08:19 AM
Last Post: GMCobraz
  How to check to see a dbf file is EOF ? DarkCoder2020 0 1,738 Jun-16-2020, 05:03 PM
Last Post: DarkCoder2020
  Building a script to check size of file upon creation mightyn00b 2 2,400 Apr-04-2020, 04:39 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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