RE: file locking...

2009-03-03 Thread bruce
March 01, 2009 11:41 AM To: undisclosed-recipients: Subject: Re: file locking... On Sun, 1 Mar 2009 10:00:54 -0800, "bruce" declaimed the following in comp.lang.python: > > Except in my situation.. the client has no knowledge of the filenaming > situation, and i might have 1000s

Re: file locking...

2009-03-02 Thread Thomas Guettler
Hi Bruce, you can do it like Maildir [1] you move (os.rename()) file or directories. Maybe something like this: You have three directories: "todo", "in-process" and "done". A process tries to os.rename from todo to in-process. If it fails, some other process has done it before. If the process is

RE: file locking...

2009-03-02 Thread Lawrence D'Oliveiro
In message , bruce wrote: > my concern about a "gatekeeper" wasn't so much related to performance, as > the possibility of race conditions... Which is what the gatekeeper will prevent. It serializes the granting of locks, and that means no race conditions. -- http://mail.python.org/mailman/li

RE: file locking...

2009-03-02 Thread bruce
python-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of Lawrence D'Oliveiro Sent: Monday, March 02, 2009 12:29 AM To: python-list@python.org Subject: RE: file locking... In message , bruce wrote: > using any kind of file lo

RE: file locking...

2009-03-02 Thread Lawrence D'Oliveiro
In message , bruce wrote: > using any kind of file locking process requires that i essentially have a > gatekeeper, allowing a single process to enter, access the files at a > time... The gatekeeper doesn't need to do any more than ensure that any particular filename is only locked by a maximum

Re: file locking...

2009-03-02 Thread Lawrence D'Oliveiro
In message , Nigel Rantor wrote: > In other words, why would you rely on a scheme that limits some > processes to certain parts of the data? That could be part of the original requirements, it's not clear from the description so far. -- http://mail.python.org/mailman/listinfo/python-list

Re: file locking...

2009-03-01 Thread Nigel Rantor
zugnush wrote: You could do something like this so that every process will know if the file "belongs" to it without prior coordination, it means a lot of redundant hashing though. In [36]: import md5 In [37]: pool = 11 In [38]: process = 5 In [39]: [f for f in glob.glob('*') if int(md5.md5(

Re: file locking...

2009-03-01 Thread zugnush
You could do something like this so that every process will know if the file "belongs" to it without prior coordination, it means a lot of redundant hashing though. In [36]: import md5 In [37]: pool = 11 In [38]: process = 5 In [39]: [f for f in glob.glob('*') if int(md5.md5(f).hexdigest(),16

Re: file locking...

2009-03-01 Thread Gabriel Genellina
En Sun, 01 Mar 2009 16:11:41 -0200, Nigel Rantor escribió: bruce wrote: i can easily setup a file read/write lock process where a client app gets/locks a file, and then copies/moves the required files from the initial dir to a tmp dir. after the move/copy, the lock is released, and the c

Re: file locking...

2009-03-01 Thread Nigel Rantor
l Message- From: python-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of Nigel Rantor Sent: Sunday, March 01, 2009 2:00 AM To: koranthala Cc: python-list@python.org Subject: Re: file locking... koranthala wrote: On Mar 1, 2:

RE: file locking...

2009-03-01 Thread bruce
.org]on Behalf Of Gabriel Genellina Sent: Sunday, March 01, 2009 9:50 AM To: python-list@python.org Subject: Re: file locking... En Sun, 01 Mar 2009 15:39:56 -0200, bruce escribió: > the issue that i'm looking at is analogous to a FIFO, where i have lots > of > files being shoved in a dir

Re: file locking...

2009-03-01 Thread Gabriel Genellina
En Sun, 01 Mar 2009 15:39:56 -0200, bruce escribió: the issue that i'm looking at is analogous to a FIFO, where i have lots of files being shoved in a dir from different processes.. on the other end, i want to allow mutiple client processes to access unique groups of these files as fast a

RE: file locking...

2009-03-01 Thread bruce
@python.org]on Behalf Of Nigel Rantor Sent: Sunday, March 01, 2009 2:00 AM To: koranthala Cc: python-list@python.org Subject: Re: file locking... koranthala wrote: > On Mar 1, 2:28 pm, Nigel Rantor wrote: >> bruce wrote: >>> Hi. >>> Got a bit of a question/is

RE: file locking...

2009-03-01 Thread bruce
-list-bounces+bedouglas=earthlink@python.org [mailto:python-list-bounces+bedouglas=earthlink@python.org]on Behalf Of MRAB Sent: Sunday, March 01, 2009 8:04 AM To: python-list@python.org Subject: Re: file locking... bruce wrote: > Hi. > > Got a bit of a question/issue that I'

Re: file locking...

2009-03-01 Thread MRAB
bruce wrote: Hi. Got a bit of a question/issue that I'm trying to resolve. I'm asking this of a few groups so bear with me. I'm considering a situation where I have multiple processes running, and each process is going to access a number of files in a dir. Each process accesses a unique group o

Re: file locking...

2009-03-01 Thread Nigel Rantor
koranthala wrote: On Mar 1, 2:28 pm, Nigel Rantor wrote: bruce wrote: Hi. Got a bit of a question/issue that I'm trying to resolve. I'm asking this of a few groups so bear with me. I'm considering a situation where I have multiple processes running, and each process is going to access a number

Re: file locking...

2009-03-01 Thread koranthala
On Mar 1, 2:28 pm, Nigel Rantor wrote: > bruce wrote: > > Hi. > > > Got a bit of a question/issue that I'm trying to resolve. I'm asking > > this of a few groups so bear with me. > > > I'm considering a situation where I have multiple processes running, > > and each process is going to access a nu

Re: file locking...

2009-03-01 Thread Nigel Rantor
bruce wrote: Hi. Got a bit of a question/issue that I'm trying to resolve. I'm asking this of a few groups so bear with me. I'm considering a situation where I have multiple processes running, and each process is going to access a number of files in a dir. Each process accesses a unique group o

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Sparky
On Jul 15, 11:38 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Sparky wrote: > > Hello! I am writing some software that will have many users accessing > > the same file resource at once for reading purposes only. I am > > programming on (Ubuntu) Linux and my question is in Windows, can I > > have it

Re: File Locking Forced? Newbie question.

2008-07-15 Thread Tim Golden
Sparky wrote: Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can I have it so that the same file can be open in read mode by more than one person or c

Re: File locking

2007-03-12 Thread John Nagle
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Dr. Who wrote: > > >>Please let me know if I'm missing something since they seem like >>normal file operations that I would hope Python would abstract away. > > > I don't think of them as "normal" operations. They are "extra" stuff that

Re: File locking

2007-03-12 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dr. Who wrote: > Please let me know if I'm missing something since they seem like > normal file operations that I would hope Python would abstract away. I don't think of them as "normal" operations. They are "extra" stuff that is not only dependent on the operating system

Re: File locking is impossible in Windows? SOLUTION

2005-01-02 Thread elbertlev
Sure it will do if one of the processes needs read access only. Scenario when you need shared rw acces with locking: In the file you have "records" say 30 bytes long, 2 processes are reading/writing these records by: lock-read-unlock or lock-write-unlock . Both processes have to open the file with

Re: File locking is impossible in Windows? SOLUTION

2004-12-22 Thread elbertlev
Sure it will do if one of the processes needs read access only. Scenario when you need shared rw acces with locking: In the file you have "records" say 30 bytes long, 2 processes are reading/writing these records by: lock-read-unlock or lock-write-unlock . Both processes have to open the file with

Re: File locking is impossible in Windows? SOLUTION

2004-12-22 Thread Pekka Niiranen
Hi everybody: I played with the class Flock and changed the line win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE,\ to win32con.FILE_SHARE_READ,\ and now I cannot copy the file over which suits me. When file is NOT locked I get: E:\>copy d:\log.txt . Overwrite .\log.txt? (Yes/No/All): y 1

Re: File locking is impossible in Windows?

2004-12-22 Thread elbertlev
I just have written the program in "C", which does the same. It behaves almost the way you described. Tthe copy command gives such diagnostic: The process cannot access the file because another process has locked a portion of the file. 0 file(s) copied. BUT THE FILE IS ACTUALLY OVERWRITTEN.. I'

Re: File locking is impossible in Windows?

2004-12-21 Thread Roger Upole
I get The process cannot access the file because another process has locked a portion of the file. 0 file(s) copied. on both Win2k and WinXP. (Python 2.4, Pywin32 build 203) Are you sure the log.txt you're copying to is actually the right one ? You should at least get a prompt to confir

Re: File locking is impossible in Windows?

2004-12-21 Thread Fredrik Lundh
Pekka Niiranen wrote: > Is there a way around this? How can I stop file being COPIED OVER while > it is being open? you could rename the file before you start updating it, and rename it back when done. -- http://mail.python.org/mailman/listinfo/python-list

Re: File locking and logging

2004-12-03 Thread Vinay Sajip
Kamus of Kadizhar <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Thanks to Robert Brewer, I got enough insight into logging to make it work > > Now I have another issue: file locking. Sorry if this is a very basic > question, but I can't find a handy reference anywhere t