[Python] purging file buffers - to make new data be written to file
Apr 7, 2002 at 10:32 pm
Can I do that from within a python script, or do I have to give a command
line argument to make Python start without buffers?
On Linux. The program is to save a memo in a slightly organised format,
but I find the file is not written until Python exits.
: Can you post a code snippet that reproduces the problem? Maybe you just need to close() the file...
: You need to call your_file_object.close() for the buffer to be written to disk (technically, that triggers a system write call, which is itself delayed by filesystem write caching. But that's a minor point). Cheers, f.
: In article , ddoc f.flush() will commit any data that python and the c library might have not yet written to the operating system. this will let other processes in the system see the new data. if you want to make sure the data ends up on disk physically, use os.fsync(f.fileno()). -- erno
Joining data from three different files to be written into three Columns
Encode exception for chinese text
What about a Python Tree container?
Adding instance attributes to types
SWIG for Python - returning 64 bit value
socket or xml error?
wxpython grid GRIDTABLE_NOTIFY_ROWS_DELETED
Recommendation of a parser generator
1 of 5
Apr 7, '02 at 10:32p
Apr 8, '02 at 5:50a
4 users in discussion
Erno Kuusela (2)
Peter Hansen (1)
Fernando Pérez (1)
Groups & Organizations
site design / logo © 2022 Grokbase