<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><span class="q"><div><blockquote type="cite"><span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-GB"><div><p><span style="font-size: 13.3333px;">
<span style="font-size: 13.3333px;">file('/var/lock/Application.lock', 'w').write(str(os.getpid()))</span></span></p><p><span style="font-size: 13.3333px;"><span style="font-size: 13.3333px;"> </span></span>
Which to be honest appears to run just fine, when I look in that file it always contains the correct process ID, for instance, 3419 or something like that.</p></div></div></blockquote><div>I honestly doubt that. The I/O is buffered and you need to flush()/close() the file. Otherwise data may not get written until python interpreter exits.
</div></div></span></blockquote></div><br></span><div> <span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
Isn't the file closed after the file().write()?  Seems to me that the great garbage collector in the sky will happily flush(), close() and forget it ever happened...  </span></div></div></blockquote><div><br>Yes, the GC will flush()/close() the file properly. My mistake, sorry about that.
<br></div><br></div>-- <br>Regards,<br>Arvind