with open(infile, "rb") as fIn:
while True:
data_fIn = fIn.read()
try:
with open(outfile, "wb") as fOut:
data = bytearray(data_fIn)
chunk_data = data.read(1024*1024)
# do something