fsync

Do I need to os.fsync() before f.close()?

Do I need to os.fsync() before f.close()? Question: "what exactly the python’s file.flush() is doing?" says you should first f.flush() and then os.fsync(f.fileno()) to make sure the data are written to the disk. Furthermore, "does close() imply flush() in Python?" claims that f.close() implies a flush(). Now, the question is: should I do os.fsync(f.fileno()) f.close() …

Total answers: 2

What exactly is file.flush() doing?

What exactly is file.flush() doing? Question: I found this in the Python documentation for File Objects: flush() does not necessarily write the file’s data to disk. Use flush() followed by os.fsync() to ensure this behavior. So my question is: what exactly is Python’s flush doing? I thought that it forces to write data to the …

Total answers: 4