You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't unpack archive that can be properly unpacked by gunzip #2
It gives an error: "Stream ended in the middle of a code."
Code that reproduces bug:
filename = "igsg2260.15i.Z"
if filename.upper().endswith(".Z"):
from unlzw import unlzw
with open(filename, "rb") as file_compr:
try:
file_raw = unlzw(file_compr.read()).decode('UTF-8')
except ValueError as e:
print("unlzw: can't unpack .Z archive with error:\n'{}'".format(e))
gunzip extract file without problems.
Github doesn't allow to attach .Z files directly, so I put it in zip archive, you'll need to unpack it first. igsg2260.15i.Z.zip
Is this package still maintained?
Noticed a similar problem when trying to use unlzw for uncompressing binary data, and I think the problem described here astropy/astropy#10714 (comment) comes down to calling
return_ffi.string(out[0], outlen[0])
in __init__.py, which truncates the data buffer at the first null character – changing this to
return_ffi.buffer(out[0], outlen[0])[:]
worked for my examples.
EDIT: The above may not be relevant for this issue, which is a case of unlzw returning retcode=-3 – looking at the file it seems that it might be missing an EOL/EOF; the last line of that file (uncompressed) looks incomplete. I guess that does not necessarily mean its contents cannot be unpacked, so perhaps the return value -3 could be handled differently, raising just a warning or adding an option to override the ValueError.
Activity
dhomeier commentedon Jan 28, 2021
Is this package still maintained?
Noticed a similar problem when trying to use
unlzwfor uncompressing binary data, and I think the problem described here astropy/astropy#10714 (comment) comes down to callingin
__init__.py, which truncates the data buffer at the first null character – changing this toworked for my examples.
EDIT: The above may not be relevant for this issue, which is a case of
unlzwreturningretcode=-3– looking at the file it seems that it might be missing an EOL/EOF; the last line of that file (uncompressed) looks incomplete. I guess that does not necessarily mean its contents cannot be unpacked, so perhaps the return value-3could be handled differently, raising just a warning or adding an option to override theValueError.