knowing when file is flushed to disk

Slawomir Nowaczyk slawomir.nowaczyk.847 at student.lu.se
Thu Aug 10 12:12:50 EDT 2006


On Wed, 09 Aug 2006 16:13:19 +0000 (GMT)
John Pote <johnpote at blueyonder.co.uk> wrote:

#> Is there some way from my Python script to know when the data is actually on 
#> the disk. BTW server OS is Linux. Presumably calling flush() and close() on 
#> the output file will initiate the disk write, but do they wait for the 
#> actual disk write or immediately return leaving the OS to do the write when 
#> it sees fit?

You may want to look into sqlite -- it is a single-file based SQL
database which is known to be extremely robust in face of problems you
describe. One of its design goals was to provide a replacement for
file storage. There is python binding http://pysqlite.org which is,
IIRC, supposed to be in stdlib for Python 2.5

That said, if your disk and/or OS is lying about the fact whether it
has actually wrote the data or not, there is not much you can do.

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( Slawomir.Nowaczyk at cs.lth.se )

If vegetarians love animals so much, why do they eat all their food???




More information about the Python-list mailing list