Re: fcntl.flock() not working when called from a function

2005-11-04 Thread thakadu
Thank you both for your replies. You are both quite correct and upon testing I get the desired results. I was mistakenly expecting the execution of the function to block at the fcntl.flock(f,fcntl.LOCK_EX) line. But I am slowly getting my head around it. Thanks -- http://mail.python.org/mailman

Re: fcntl.flock() not working when called from a function

2005-11-04 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, thakadu <[EMAIL PROTECTED]> wrote: >The following code works as expected when run in the main body of a >python script (ver 2.3.5) on OpenBSD v3.8. but when it is in the body >of a function definition it does not work. It does not raise any errors >but it simply does

Re: fcntl.flock() not working when called from a function

2005-11-04 Thread jepler
The file you open() may be closed as soon as it is no longer possible to refer to it. So in the first case, because the top-level variable 'f' continues to refer to the opened file, the file may not be closed. In the second case, no variable refers to the opened file after lock() returns, so P

fcntl.flock() not working when called from a function

2005-11-04 Thread thakadu
The following code works as expected when run in the main body of a python script (ver 2.3.5) on OpenBSD v3.8. but when it is in the body of a function definition it does not work. It does not raise any errors but it simply does not block as expected. I have repeated this in both a cgi envirnoment