Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
The close method is defined and flushing and closing a file, so it should not return until that's done. What command are you using to create the temp file? re command to write the file: f=open(fn,'w') ... then create HTML text in a string f.write(html) f.close --

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
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? It's a relatively new MacBook Pro with a solid state disk. I've not noticed any other disk problems. I did a

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
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) Also on what OS X file system type does the file being

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
The file system is Mac OS Extended Journaled (default as out of the box). I ran a repair disk .. .while it found and fixed what it called minor problems, it did something. However, the repair did not fix the problem. I just ran the program again and the source is 47,970 bytes and target

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 09:26:21 UTC+1, Cameron Simpson wrote: | Question: is the size of the incomplete file a round number? (Like | a multiple of a decent sized power of 2) [...] | Source (correct one) is 47,970 bytes. Target after copy of 45,056 | bytes. I've tried

Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 10:22:21 UTC+1, Chris Angelico wrote: On Fri, Apr 12, 2013 at 7:18 PM, Rob Schneider rmsc...@gmail.com wrote: f.close Yep, there's the problem! See my previous post for details. Change this to: f.close() and you should be sorted. ChrisA

shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
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

Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
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? -- http://mail.python.org/mailman/listinfo/python-list