Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31633
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andrea.crotti.0@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; "'w')": 0.09; 'subject:files': 0.09; 'useful,': 0.13; 'to:name:python-list': 0.15; '(should': 0.16; 'happily': 0.16; 'trying': 0.21; 'this:': 0.23; 'somewhere': 0.24; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; "i'm": 0.29; 'function': 0.30; 'file': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'glad': 0.86 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=mwBTKQpBLL/DkWIZ9FuoaHsk+CRItl4qsxyRapuSX/w=; b=aFytxw+L1BwwU54e5M/Kv4sGqD6NO6x5tYHbzSgQd+PsBjJcaaW+G68zhfDH3Fwdfl 490POtcLP5VUPmBsk09u6NEpnBFu+Se09ugbbjfNYZT4o9EuZsH/H0YgcCCleYhnrli3 5ee3dPP5xHbqiwhgwyZnFUfhVA2tiWFjwBlLSHHC4/HLUBDbi2ibhKkpm6UY01jBll1X +49hb5GapflaVLEeKS9t8BlAlHPtV8H+jPncEZeFSkhHuZN2dt3qegDmsY33R9zfiCPj 2htdwmPWq4Awn7EZPmazvu9QT+pnZgihJWJ6UKJ4DxFmTQT0vwDJnxROjsvA9OMxVWXy C+IA== |
| MIME-Version | 1.0 |
| Date | Thu, 18 Oct 2012 14:14:02 +0100 |
| Subject | locking files on Linux |
| From | andrea crotti <andrea.crotti.0@gmail.com> |
| To | python-list <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2430.1350566044.27098.python-list@python.org> (permalink) |
| Lines | 14 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350566044 news.xs4all.nl 6954 [2001:888:2000:d::a6]:52044 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31633 |
Show key headers only | View raw
I'm trying to understand how I can lock a file while writing on it,
because I might have multiple processes working on it at the same time.
I found the fcntl.lockf function but if I do this:
In [109]: locked = open('locked.txt', 'w')
In [110]: fcntl.lockf(locked, fcntl.LOCK_EX)
I can happily open the file with vim from somewhere and write on it, so
it doesn't seem to be very useful, or am I missing something?
I can otherwise use the classic ".lock" file when working on it, but I
would be glad to see a smarter solution (should only work on Linux)..
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 14:14 +0100
Re: locking files on Linux Grant Edwards <invalid@invalid.invalid> - 2012-10-18 13:27 +0000
Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 14:44 +0100
Re: locking files on Linux Grant Edwards <invalid@invalid.invalid> - 2012-10-18 13:57 +0000
Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 15:49 +0100
Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 16:04 +0100
Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 16:08 +0100
Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 16:31 +0100
Re: locking files on Linux andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-19 13:15 +0100
Re: locking files on Linux Nobody <nobody@nowhere.com> - 2012-10-19 15:36 +0100
Re: locking files on Linux Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-10-18 14:58 +0100
csiph-web