Closed liuzm617 closed 2 years ago
Same problem occured in the master-version, while not occured in version 0.25 from pypi
with open(fullpath,'rb') as fs:
fs.readable() #True
my_client.set_headers({'Upload-Metadata': f'fileName {fileName}'})
uploader: Uploader = my_client.uploader(file_stream=fs,chunk_size=64_000)
fs.readable() #False
#print_upload_info(uploader)
uploader.upload(stop_at=200_000)
print_upload_info(uploader)
use this version:
@property
def file_size(self):
"""
Return size of the file.
"""
stream = self.get_file_stream()
stream.seek(0, os.SEEK_END)
return stream.tell()
Thanks for the report, @tzblic! Thanks for the patch, @honglei!
`
fs = open('path/to/file.ext') uploader = my_client.uploader(file_stream=fs, chunk_size=200)
##Filestream is closed in get_file_size function , If you use it again, you will get an error: ValueError: I/O operation on closed file.**
uploader.upload()