-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Possibly a bug in the "gettingData.py" example, when writing large files with more than one obj in chunk['ObjectList'].
ds3_python3_sdk/samples/gettingData.py
Line 83 in 426e836
| objectStream = open(objectNameToDestinationPathMap[obj['Name']], "wb") |
Opening the target file with "wb" would truncate it, before seek() moves the pointer to the write position. The result is a file that contains only NUL bytes except for the last obj block written.
A fix would be to open the file in "r+b" more, that is both seek-able and write-able without truncating.
pathlib.Path(objectNameToDestinationPathMap[obj['Name']]).touch() # ensure file exists
objectStream = open(objectNameToDestinationPathMap[obj['Name']], "r+b")
Metadata
Metadata
Assignees
Labels
No labels