I am downloading a compressed file from the internet:
with lzma.open(urllib.request.urlopen(url)) as file:
for line in file:
...
After having downloaded and processed a a large part of the file, I eventually get the error:
File "/usr/lib/python3.4/lzma.py", line 225, in _fill_buffer raise EOFError("Compressed file ended before the " EOFError: Compressed file ended before the end-of-stream marker was reached
I am thinking that it might be caused by an internet connection that drops or the server not responding for some time. If that is the case, is there anyway to make it keep trying, until connection is reestablished, instead of throwing an exception. I don't think it is a problem with the file, as I have manually downloaded many files like it from the same website manually and decompressed it. I have also been able to download and decompress some smaller files with Python. The file I am trying to download has a compressed size of about 20 GB.
urllib.request.urlopen()
andgzip
. About 12 hours in I get a similar traceback. – Bicephalousurllib
not resolved your problem).EOF
andanswer end header
how to separate each one ? My opinion :urllib
detect fileEOF
as answerEND
. – Ripleigh