fo.flush() & fo.write() on windows

Roberts, Robert J robert_j_roberts at rl.gov
Mon Aug 30 01:29:36 CEST 1999


Am I asking too much?

pseudo code:

    fo = __builtin__.open(foName, 'a')
    foSize = os.stat(foName)[6]     # if foSize = 100...
    fo.write('Some string.')             # fo.write() returns None
    foSize = os.stat(foName)[6]    # ...foSize STILL = 100.
    fo.flush()
    foSize = os.stat(foName)[6]    # ...foSize STILL = 100.
    fo.close()                                # 'Some string' appears in
fo.
    foSize = os.stat(foName)[6]    # foSize = foSize + 'Some string' #
of bytes.

I am running Python 1.5.2 on Windows 95. fo.write() appears to be
buffering the write and returning None for bytes written on fo.write().
fo.flush() appears to do nothing.

...or... am I missing something?






More information about the Python-list mailing list