Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25282

Re: [Python] RE: How to safely maintain a status file

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.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; 'subject:: [': 0.03; 'subject:Python': 0.05; 'subject:file': 0.07; 'subject:How': 0.09; 'expected.': 0.09; 'throw': 0.09; 'file,': 0.15; 'sat,': 0.15; 'slightly': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'posix': 0.16; 'rotation': 0.16; 'truncating': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'subject:] ': 0.19; 'windows': 0.19; 'file.': 0.20; 'error.': 0.21; 'received:209.85.214.174': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'handling': 0.27; 'message-id:@mail.gmail.com': 0.27; 'probably': 0.29; 'towards': 0.32; 'file': 0.32; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'exist': 0.35; 'fresh': 0.35; 'open': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'anything': 0.36; 'should': 0.36; 'possible': 0.37; 'moment': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'application': 0.40; 'header:Received:5': 0.40; 'matter': 0.61; 'close': 0.63; 'different': 0.63; 'more': 0.63; 'else.': 0.65; 'jul': 0.65; 'saving': 0.72; 'lean': 0.84; 'subject:status': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=21TyRgMQWAn7p6K5vfr14gyYzaabWwqvmzimwn1Tl4Y=; b=xm6X5sTlWQXvgbJvOL9tA31qo5a7kQWuik8LcQy/pBpMWEZHm2knpCfwV+tXem11uO 6rlcHtlJb7E2CqQgQ8bjIKiSG9jo812cP4qkIZRmFBYNxemgxRBfJ2Huvl4G7Di5gpVu Hne//HbCpLBNBk+XrtsaxBwfbYoEX09m5C5wdBfu3z6Jt7ecFQzW11+W1PmfIOOARZgn a1GfLLEdYfp0f0JXibwb6NvtQELC3rJMB4Ccl4gD4FQfca0tyNwIzukZowZAP0nS+aMu 5uV0NKBjCGYPEcTyW4iCWMkwwc9Xy+vsdlYf7t/ku39YSldjU94KtR12OAcVzzK97q2/ mhvQ==
MIME-Version 1.0
In-Reply-To <5B80DD153D7D744689F57F4FB69AF474165562E0@SCACMX008.exchad.jpmchase.net>
References <CAOV1wRVtm27yWez1HZuN8=ia-TyM2aXp9QCUbSZ5aZExP_ZChA@mail.gmail.com> <sanjv7lo0vb3rlhip4ov1gpgp4gs51bvfr@invalid.netcom.com> <4FF9F454.40207@shopzeus.com> <jtcvf8$ock$1@dough.gmane.org> <mailman.2034.1342096256.4697.python-list@python.org> <4ffecef4$0$6877$e4fe514c@news2.news.xs4all.nl> <4FFF0CB7.3030007@shopzeus.com> <mailman.2059.1342118365.4697.python-list@python.org> <fd846619-7de7-4c3b-8ed6-a14e9d55956e@p6g2000yqg.googlegroups.com> <mailman.2061.1342145524.4697.python-list@python.org> <4fff926b$0$29965$c3e8da3$5496439d@news.astraweb.com> <62e90523-a160-4e28-8109-9ce32d8952e1@googlegroups.com> <5B80DD153D7D744689F57F4FB69AF474165560E7@SCACMX008.exchad.jpmchase.net> <50005A96.3010305@gonnerman.org> <5B80DD153D7D744689F57F4FB69AF474165562E0@SCACMX008.exchad.jpmchase.net>
Date Sat, 14 Jul 2012 04:19:24 +1000
Subject Re: [Python] RE: How to safely maintain a status file
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.2096.1342203567.4697.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1342203567 news.xs4all.nl 6856 [2001:888:2000:d::a6]:53672
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25282

Show key headers only | View raw


On Sat, Jul 14, 2012 at 3:59 AM, Prasad, Ramit
<ramit.prasad@jpmorgan.com> wrote:
> I lean slightly towards the POSIX handling with the addition that
> any additional write should throw an error. You are now saving to
> a file that will not exist the moment you close it and that is probably
> not expected.

There are several different possible "right behaviors" here, but they
depend more on the application than anything else. With a log file,
for instance, the act of deleting it is more a matter of truncating it
(dispose of the old history), so the right thing to do is to start a
fresh file. Solution: Close the file and re-open it periodically. But
I don't know of an efficient way to do that with Windows semantics.
Renaming/moving an open file in order to perform log rotation isn't
all that easy.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: How to safely maintain a status file Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-12 14:30 +0200
  Re: How to safely maintain a status file Hans Mulder <hansmu@xs4all.nl> - 2012-07-12 15:19 +0200
    Re: How to safely maintain a status file Laszlo Nagy <gandalf@shopzeus.com> - 2012-07-12 19:43 +0200
    Re: How to safely maintain a status file Christian Heimes <lists@cheimes.de> - 2012-07-12 20:39 +0200
      Re: How to safely maintain a status file Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-12 18:20 -0700
        Re: How to safely maintain a status file Chris Angelico <rosuav@gmail.com> - 2012-07-13 12:12 +1000
          Re: How to safely maintain a status file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 03:13 +0000
            Re: How to safely maintain a status file Gene Heskett <gheskett@wdtv.com> - 2012-07-12 23:49 -0400
              Re: How to safely maintain a status file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 04:21 +0000
            Re: How to safely maintain a status file rantingrickjohnson@gmail.com - 2012-07-12 21:26 -0700
              Re: How to safely maintain a status file Chris Angelico <rosuav@gmail.com> - 2012-07-13 16:02 +1000
              Re: How to safely maintain a status file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-13 07:14 +0000
                Re: How to safely maintain a status file Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-13 13:29 -0400
              RE: How to safely maintain a status file "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-13 16:00 +0000
              Re: [Python] RE: How to safely maintain a status file Chris Gonnerman <chris@gonnerman.org> - 2012-07-13 12:27 -0500
              RE: [Python] RE: How to safely maintain a status file "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-13 17:59 +0000
                Re: [Python] RE: How to safely maintain a status file Hans Mulder <hansmu@xs4all.nl> - 2012-07-13 20:28 +0200
                Re: [Python] RE: How to safely maintain a status file MRAB <python@mrabarnett.plus.com> - 2012-07-13 20:57 +0100
                Re: [Python] RE: How to safely maintain a status file Christian Heimes <lists@cheimes.de> - 2012-07-13 22:21 +0200
              Re: [Python] RE: How to safely maintain a status file Chris Angelico <rosuav@gmail.com> - 2012-07-14 04:19 +1000
              RE: How to safely maintain a status file Chris Gonnerman <chris@gonnerman.org> - 2012-07-13 15:15 -0500
                Re: How to safely maintain a status file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-14 01:53 +0000

csiph-web