Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Commit

Permalink
If a fragment fails to upload, keep trying until it succeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBerdik committed Jun 23, 2019
1 parent 7db0470 commit 5e75389
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion InfiniDrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ def print_ascii_logo():
doc.save(mem_doc)

# Upload Word document to Google Drive
driveAPI.store_doc(driveConnect, dirId, str(docNum) + ".docx", mem_doc)
while True:
try:
driveAPI.store_doc(driveConnect, dirId, str(docNum) + ".docx", mem_doc)
except:
print('Fragment ' + str(docNum) + ' failed to upload. Retrying.')
continue
break

# Increment docNum for next Word document and read next chunk of data.
docNum = docNum + 1
Expand Down

0 comments on commit 5e75389

Please sign in to comment.