Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25229
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gandalf@shopzeus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'puts': 0.07; 'rename': 0.07; 'subject:file': 0.07; 'try:': 0.07; 'subject:How': 0.09; 'blocking': 0.09; 'e.errno': 0.09; 'os.name': 0.09; 'def': 0.10; 'suggest': 0.11; 'file,': 0.15; 'b):': 0.16; 'operation.': 0.16; 'renames': 0.16; 'suppport': 0.16; 'termination.': 0.16; 'windows': 0.19; 'file.': 0.20; 'exists.': 0.22; 'to:2**1': 0.23; 'raise': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'case,': 0.29; 'code': 0.31; 'implement': 0.32; 'file': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'received:192.168.0': 0.35; 'there': 0.35; 'except': 0.36; 'but': 0.36; 'enough': 0.36; 'does': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'side': 0.61; 'received:62': 0.62; 'between': 0.63; 'abnormal': 0.84; 'received:192.168.0.101': 0.84; 'received:192.168.13': 0.84; 'received:192.168.13.238': 0.84; 'received:62.179': 0.84; 'received:62.179.121': 0.84; 'received:edge03.upcmail.net': 0.84; 'received:upcmail.net': 0.84; 'subject:status': 0.84 |
| X-SourceIP | 89.134.225.226 |
| Date | Thu, 12 Jul 2012 19:46:17 +0200 |
| From | Laszlo Nagy <gandalf@shopzeus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 |
| MIME-Version | 1.0 |
| To | Plumo <richardbp@gmail.com>, python-list@python.org |
| Subject | Re: How to safely maintain a status file |
| References | <CAOV1wRVtm27yWez1HZuN8=ia-TyM2aXp9QCUbSZ5aZExP_ZChA@mail.gmail.com> <mailman.1917.1341748397.4697.python-list@python.org> <ea62c8fb-fccd-49a6-b715-4749f5fca7ce@s6g2000pbi.googlegroups.com> |
| In-Reply-To | <ea62c8fb-fccd-49a6-b715-4749f5fca7ce@s6g2000pbi.googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.2056.1342116183.4697.python-list@python.org> (permalink) |
| Lines | 23 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342116183 news.xs4all.nl 6974 [2001:888:2000:d::a6]:54509 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25229 |
Show key headers only | View raw
>> Windows doesn't suppport atomic renames if the right side exists. I >> suggest that you implement two code paths: >> >> if os.name == "posix": >> rename = os.rename >> else: >> def rename(a, b): >> try: >> os.rename(a, b) >> except OSError, e: >> if e.errno != 183: >> raise >> os.unlink(b) >> os.rename(a, b) > > Problem is if the process is stopped between unlink and rename there > would no status file. Yes, and actually it does not need to be an abnormal termination. It is enough if the OS scheduler puts this process on hold for some time... But using a lock file, the problem can be solved. However in that case, reading a status file can be a blocking operation.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: How to safely maintain a status file Christian Heimes <lists@cheimes.de> - 2012-07-08 13:53 +0200
Re: How to safely maintain a status file Plumo <richardbp@gmail.com> - 2012-07-08 22:50 -0700
Re: How to safely maintain a status file Christian Heimes <lists@cheimes.de> - 2012-07-09 10:17 +0200
Re: How to safely maintain a status file Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-12 19:46 +0200
csiph-web