Re: fcntl problems

2007-08-31 Thread Miles
On 8/30/07, mhearne808 wrote: I'm having a number of problems with the fcntl module. Read this first: http://linux.die.net/man/2/flock First of all, if I try this: file = open(counter.txt,w+) fcntl.flock(file.fileno(), fcntl.LOCK_NB) I get this:

Re: fcntl problems

2007-08-31 Thread Miles
Sorry, that last quote-only reply was accidental. :) On 8/30/07, mhearne808 wrote: I've been doing some experiments, and here are some specific examples to try. [snipped examples] From these last two experiments I can only conclude that file locking isn't doing a durned thing. What's

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 31, 12:23 am, Miles [EMAIL PROTECTED] wrote: Sorry, that last quote-only reply was accidental. :) On 8/30/07, mhearne808 wrote: I've been doing some experiments, and here are some specific examples to try. [snipped examples] From these last two experiments I can only conclude

Re: fcntl problems

2007-08-31 Thread Miles
On 8/31/07, mhearne808 wrote: I have a script that will be run from a cron job once a minute. One of the things this script will do is open a file to stash some temporary results. I expect that this script will always finish its work in less than 15 seconds, but I didn't want to depend on

Re: fcntl problems

2007-08-31 Thread Hrvoje Niksic
mhearne808[insert-at-sign-here]gmail[insert-dot-here]com [EMAIL PROTECTED] writes: I think I'm still confused. What Miles tried to tell you is that you should call fcnt.flock from both PA and PB. In the example you posted, you failed to call it from PB. No lock call, so no locking happened.

Re: fcntl problems

2007-08-31 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 31, 8:42 am, Miles [EMAIL PROTECTED] wrote: On 8/31/07, mhearne808 wrote: I have a script that will be run from a cron job once a minute. One of the things this script will do is open a file to stash some temporary results. I expect that this script will always finish its work in

Re: fcntl problems

2007-08-31 Thread Miles
On 8/31/07, mhearne808 wrote: Looking at my flock(3) man page, I'm guessing that 35 is the error code for EWOULDBLOCK. Which system header file am I supposed to look in to figure that magic number out? I got the error number by looking at the IOError exception raised when playing with the

Re: fcntl problems

2007-08-31 Thread Michael J. Fromberger
In article [EMAIL PROTECTED], mhearne808[insert-at-sign-here]gmail[insert-dot-here]com [EMAIL PROTECTED] wrote: Looking at my flock(3) man page, I'm guessing that 35 is the error code for EWOULDBLOCK. Which system header file am I supposed to look in to figure that magic number out? On a

Re: fcntl problems

2007-08-31 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Miles wrote: except IOError, e: if e.args[0] == 35: Why not except IOError, (ErrNo, Msg) : if ErrNo == errno.EAGAIN : -- http://mail.python.org/mailman/listinfo/python-list

fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386 i386 Python 2.5.1 (built from source) OK, the weirdness: First

Re: fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 30, 4:19 pm, mhearne808[insert-at-sign-here]gmail[insert-dot- here]com [EMAIL PROTECTED] wrote: I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT