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)
The method
download_node_srcfails if the download doesn't complete in a single part. In my case this lead to a seemingly unrelated errorAttributeError: 'bytes' object has no attribute 'tell'deep in the tarfile module. The exception handler,assigned a bytes object to
dl_contentsinstead of aBytesIO. 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