shutil.copyfile is incomplete (truncated)

Rob Schneider rmschne at gmail.com
Thu Apr 11 14:12:47 EDT 2013


Using Python 2.7.2 on OSX, I have created a file in temp space, then use the function "shutil.copyfile(fn,loc+fname)" from "fn" to "loc+fname".

At the destination location, the file is truncated. About 10% of the file is lost.  Original file is unchanged.

I added calls to "statinfo" immediately after the copy, and all looks ok (correct file size).

filecmp.cmp(fn,loc+fname)
print "Statinfo    :"+fn+":\n", os.stat(fn)
print "Statinfo    :"+loc+fname+":\n", os.stat(loc+fname)

But when I look at the file in Finder, destination is smaller and even looking at the file (with text editor) file is truncated.

What could be causing this?



More information about the Python-list mailing list