Re: How to find out if another process is using a file

2007-01-19 Thread Amit Khemka
> > Yes, that would work very neatly but I don't have any control over the > writing process. I think the modification time route might be the best > option, but thanks to all for their replies. Its not pythonic, but may be "lsof" on POSIX can be helpful: see: http://www.physiol.ox.ac.uk/Computi

Re: How to find out if another process is using a file

2007-01-19 Thread Tom Wright
Jean-Paul Calderone wrote: > A better solution is to name or place files which are begin written in a > which is recognizable and only rename or move them to their final location > when they have been completely written. > > For example, name files ".new" as they are being written. When they are

Re: How to find out if another process is using a file

2007-01-19 Thread Diez B. Roggisch
Tom Wright wrote: > js wrote: >> How about using lock? >> Let writing process locks the files before writing, and unlock after >> the job's done. > > Is locking mandatory or co-operative? I don't have any control over the > process which is doing the writing, so if it's co-operative it's no good

Re: How to find out if another process is using a file

2007-01-19 Thread Tom Wright
js wrote: > How about using lock? > Let writing process locks the files before writing, and unlock after > the job's done. Is locking mandatory or co-operative? I don't have any control over the process which is doing the writing, so if it's co-operative it's no good to me. If it's mandatory, th

Re: How to find out if another process is using a file

2007-01-18 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Donn Cave <[EMAIL PROTECTED]> writes: |> > |> |> > |> O_EXCL fails if the file exists at all - whether closed or open. |> > |> > Yes. In theory. In practice, it usually works on normal files, provided |> > that all opens are local. Under some circumstances, it

Re: How to find out if another process is using a file

2007-01-18 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nick Maclaren) wrote: > In article <[EMAIL PROTECTED]>, > Donn Cave <[EMAIL PROTECTED]> writes: > |> In article <[EMAIL PROTECTED]>, > |> "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > |> > "Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaj

Re: How to find out if another process is using a file

2007-01-18 Thread Nick Maclaren
In article <[EMAIL PROTECTED]>, Donn Cave <[EMAIL PROTECTED]> writes: |> In article <[EMAIL PROTECTED]>, |> "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: |> > "Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaje |> > news:[EMAIL PROTECTED] |> > |> > > I'm writing a program which reads a ser

Re: How to find out if another process is using a file

2007-01-18 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > "Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaje > news:[EMAIL PROTECTED] > > > I'm writing a program which reads a series of data files as they are > > dumped > > into a directory by another process. At t

Re: How to find out if another process is using a file

2007-01-18 Thread Jean-Paul Calderone
On Thu, 18 Jan 2007 14:34:52 -0300, Gabriel Genellina <[EMAIL PROTECTED]> wrote: >"Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaje >news:[EMAIL PROTECTED] > >> I'm writing a program which reads a series of data files as they are >> dumped >> into a directory by another process. At the momen

Re: How to find out if another process is using a file

2007-01-18 Thread Gabriel Genellina
"Tom Wright" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I'm writing a program which reads a series of data files as they are > dumped > into a directory by another process. At the moment, it gets sporadic bugs > when it tries to read files which are only partially writt

Re: How to find out if another process is using a file

2007-01-18 Thread js
How about using lock? Let writing process locks the files before writing, and unlock after the job's done. I think it'd work file in most environment. On 1/19/07, Tom Wright <[EMAIL PROTECTED]> wrote: > I'm writing a program which reads a series of data files as they are dumped > into a director

How to find out if another process is using a file

2007-01-18 Thread Tom Wright
I'm writing a program which reads a series of data files as they are dumped into a directory by another process. At the moment, it gets sporadic bugs when it tries to read files which are only partially written. I'm looking for a function which will tell me if a file is opened in write-mode by an