Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Closed as not planned
Description
Bug report
Bug description:
blocksize=8192#262144 # default 8192local_tmp_filepath.touch(exist_ok=True)## backward 1 blocksize to ensure data correctnessrequest_offset=max(0,local_tmp_filepath.stat().st_size-blocksize)ifrequest_offset>0:print(f"continue downloading at position{request_offset}.")withlocal_tmp_filepath.open('r+b')asf:f.seek(request_offset)ftp_hook.get_conn().retrbinary(f"RETR{str(remote_filepath)}",f.write,rest=request_offset,blocksize=blocksize)
when I used the code above to download some ftp files from the server, there would be a condition that my file finish downloaded has a byte of 32768 larger than it should be.
I don't know what's wrong with it, it's conditional, about 1~2 time in 10 downloads. great thanks!
CPython versions tested on:
3.10
Operating systems tested on:
Linux