shutil.copyfile is incomplete (truncated)

Cameron Simpson cs at zip.com.au
Thu Apr 11 21:15:50 EDT 2013


On 12Apr2013 00:06, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
| On Thu, 11 Apr 2013 19:55:53 +0000, Neil Cerutti wrote:
| > On 2013-04-11, Rob Schneider <rmschne at gmail.com> wrote:
| >> Thanks. Yes, there is a close function call  before the copy is
| >> launched. No other writes. Does Python wait for file close command to
| >> complete before proceeding?
| > 
| > The close method is defined and flushing and closing a file, so it
| > should not return until that's done.
| 
| But note that "done" in this case means "the file system thinks it is 
| done", not *actually* done.

Unless there's a reboot (or crash) in between, the view from the
app should be consistent and correct.

| Hard drives, especially the cheaper ones, 
| lie. They can say the file is written when in fact the data is still in 
| the hard drive's internal cache and not written to the disk platter. 
| Also, in my experience, hardware RAID controllers will eat your data, and 
| then your brains when you try to diagnose the problem.
| 
| I would consider the chance that the disk may be faulty, or the file 
| system is corrupt. Does the problem go away if you write to a different 
| file system or a different disk?

Or that the filesystem may be full? Of course, that's usually obvious
more widely when it happens...

Question: is the size of the incomplete file a round number? (Like
a multiple of a decent sized power of 2>)

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

I am now convinced that theoretical physics is actual philosophy.
        - Max Born



More information about the Python-list mailing list