shutil.copyfile is incomplete (truncated)

88888 Dihedral dihedral88888 at googlemail.com
Fri Apr 12 11:49:13 EDT 2013


Steven D'Aprano於 2013年4月12日星期五UTC+8上午8時06分21秒寫道:
> 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. 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.
> 
> 
Don't you model this as a non-blocking operation in 
your program?


> 
> 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?
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven


Back-ups and read-back verifications are important for 
those who care.



More information about the Python-list mailing list