Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling .z files as gzip #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

handling .z files as gzip #191

wants to merge 2 commits into from

Conversation

seanmacavaney
Copy link
Collaborator

regarding #189

Took the opportunity to improve the tests here for the variety of formats, etc. that TrecDocs may encounter.

@ArthurCamara -- mind running python -m tests.integration.disks45 when using your .z files when you have a chance?

@ArthurCamara
Copy link
Contributor

That did not work, actually. 🤔 seems like Python's Gzip implementation does not recognize it as a gzip file (however, gunzip can decompress it no problem)
Digging deeper, .z is a REALLY old file format, created by using Pack: https://en.wikipedia.org/wiki/Pack_(compression)
and Gzip's documentation says that it cannot handle it:

Note that additional file formats which can be decompressed by the gzip and gunzip programs, such as those produced by compress and pack, are not supported by this module.

I've searched for a bit, but couldn't find any Python library that can deal with it properly, it seems.

@seanmacavaney
Copy link
Collaborator Author

Hmmm, okay, I see.

Even though the format is relatively simple, I'm not so keen on writing my own parser for the format.

So the only other reasonable option for supporting it in the software itself would be to invoke gunzip (or similar) when it encounters these files. This comes with overhead and isn't good for cross-platform compatibility, but I think I could live with it to handle this (presumably) uncommon format.

@ArthurCamara
Copy link
Contributor

I agree. I don't see a reason to worry too much about it. We can either 1. Pip everything into gunzip using subprocess.Popen even only os.system if we don't care about the return value or 2. Throw an error message asking the user to do that by themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants