safe simultaneous file append?

Graham Guttocks graham_guttocks at yahoo.co.nz
Mon Oct 8 02:12:57 EDT 2001


Greetings,

Given the following code, is there any danger of the logfile being
corrupted if two copies of this code try to append at the same time?

  file = open('logfile.txt','a+')
  file.write('testing' + '\n')
  file.close()

If so, how do I guard against this?  This is on UNIX BTW.

Regards,
Graham

__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1




More information about the Python-list mailing list