Newbie Q: File accessing

Todd Harris todd.harris at honeywell.com
Wed Jun 19 12:21:40 EDT 2002


Hi, I apologize if this question has been beaten to death or if there's just
something that I haven't been seeing, but here's my problem (with a little
bit of background):

I have a file out on the network somewhere that stores info as text. I'm
writing a Python script that updates that file. However, it's a multi-user
application, and so my problem is that one user's script may be in the
middle of writing to that file while another user's script is attempting to
read that file or <even worse> writing to that file as well.

For those of you who use Microsoft <gulp...flame shield on> Word, when a
document is opened by one user, and another user tries to access it, they
can open it for read only. Obviously, Word has made some file attribute
where it is locked to that first user, and only that first user can write to
it while they have it open. Is there a way to do this in Python? Or what
other possible options do I have? I've looked been using the open(
filePath ) function as well as the os.open( ) function and os.access( ) to
check my progress, but can't seem to figure out how to get around this.
Thanks,

Todd





More information about the Python-list mailing list