Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25286
| Date | 2012-07-13 20:57 +0100 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: [Python] RE: How to safely maintain a status file |
| References | (11 earlier) <62e90523-a160-4e28-8109-9ce32d8952e1@googlegroups.com> <5B80DD153D7D744689F57F4FB69AF474165560E7@SCACMX008.exchad.jpmchase.net> <50005A96.3010305@gonnerman.org> <mailman.2094.1342202431.4697.python-list@python.org> <500068bd$0$6893$e4fe514c@news2.news.xs4all.nl> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2099.1342209459.4697.python-list@python.org> (permalink) |
On 13/07/2012 19:28, Hans Mulder wrote: > On 13/07/12 19:59:59, Prasad, Ramit 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. > Strictly speaking, the file does exist, it's just that there are no names referring to it. When any handles to it are also closed, the file _can_ truly be deleted. As has been said before, in the *nix world, "unlink" _doesn't_ delete a file, it deletes a name. > I'd say: it depends. > > If the amount of data your script needs to process does not fit > in RAM, then you may want to write some of it to a temporary file. > On a Posix system, it's entirely normal to unlink() a temp file > first thing after you've created it. The expectation is that the > file will continue to exists, and be writeable, until you close it. > > In fact, there's a function in the standard library named > tempfile.TemporaryFile that does exactly that: create a file > and unlink it immediately. This function would be useless > if you couldn't write to your temporary file. > It's possible to create a temporary file even in Windows.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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