write to the same file from multiple processes at the same time?
Peter Hansen
peter at engcorp.com
Fri May 27 18:02:56 EDT 2005
Grant Edwards wrote:
> On 2005-05-27, Peter Hansen <peter at engcorp.com> wrote:
>>Unfortunately this assumes that the open() call will always succeed,
>>when in fact it is likely to fail sometimes when another file has
>>already opened the file but not yet completed writing to it, AFAIK.
>
> Not in my experience. At least under Unix, it's perfectly OK
> to open a file while somebody else is writing to it. Perhaps
> Windows can't deal with that situation?
Hmm... just tried it: you're right! On the other hand, the results were
unacceptable: each process has a separate file pointer, so it appears
whichever one writes first will have its output overwritten by the
second process.
Change the details, but the heart of my objection is the same.
-Peter
More information about the Python-list
mailing list