-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Description
The method download_node_src fails if the download doesn't complete in a single part. In my case this lead to a seemingly unrelated error AttributeError: 'bytes' object has no attribute 'tell' deep in the tarfile module. The exception handler,
try:
dl_contents = io.BytesIO(urlopen(node_url).read())
except IncompleteRead as e:
logger.warning('Incomplete read while reading'
'from {}'.format(node_url))
dl_contents = e.partial
assigned a bytes object to dl_contents instead of a BytesIO. However, updating the exception still did not work because "partial" really does mean partial, and is not the complete file so there is no way to use this. Also, simply calling read() again also appears not to be the way to handle multipart.
I got this to work by using requests, which appears to handle this properly
import requests
dl_contents = io.BytesIO(requests.get(node_url).content)
bagerard, neutrinoceros, StefanRijnhart, atom-andrew, remss and 6 more
Metadata
Metadata
Assignees
Labels
No labels