Python v.s. huge files PROBLEM!!

Jose Rivera jriveramerla at yahoo.com
Thu Jul 18 18:33:30 EDT 2002


Hi..
Scenario:
OS      : WinNT 4.0
FileName: RESPALDO_MENSUAL_Data.MDF
Size    : 243,386,941,440 bytes

Problem:
I want to copy this file to another disk. Both disks have 500 GB of
free space.

Microsoft problem:
   You May Not Be Able to Copy Large Files on Computers That Are
Running Windows NT 4.0 or Windows 2000 (Q259837)

Workaround suggested by Microsoft:
   Use Backup / Restore utilities
  Result: They didn't work either... using HP OmniBack

Workaround made by us:
Make a python program that read and writes to the other file in
theother disk.

Python Code:

import sys

if len(sys.argv) != 3:
	print 'Format:'
	print '\t pyCopy.exe SourceFile EndFile'
else:
	fn1=sys.argv[1]
	fn2=sys.argv[2]
	f1=open(fn1,'rb')
	f2=open(fn2,'wb')
	data=f1.read(1024*1000)
	while data:
		f2.write(data)
		data=f1.read(1024*1000)
	f1.close()
	f2.close()

Result:
IOError: [Errno 22] Invalid argument

Question:
Is there anything wrong?



More information about the Python-list mailing list