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

Make support for bz2 compression optional #1295

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

tsibley
Copy link
Contributor

@tsibley tsibley commented Jun 16, 2023

Python may be compiled without bz2 support, in which case import of the standard library module fails with a traceback like:

    …/lib/python3.7/site-packages/fsspec/__init__.py:12: in <module>
        from .compression import available_compressions
    …/lib/python3.7/site-packages/fsspec/compression.py:2: in <module>
        from bz2 import BZ2File
    …/lib/python3.7/bz2.py:19: in <module>
        from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

While rare, it does happen, so make the bz2 registration optional.

Python may be compiled without bz2 support, in which case import of the
standard library module fails with a traceback like:

        …/lib/python3.7/site-packages/fsspec/__init__.py:12: in <module>
            from .compression import available_compressions
        …/lib/python3.7/site-packages/fsspec/compression.py:2: in <module>
            from bz2 import BZ2File
        …/lib/python3.7/bz2.py:19: in <module>
            from _bz2 import BZ2Compressor, BZ2Decompressor
    ModuleNotFoundError: No module named '_bz2'

While rare, it does happen, so make the bz2 registration optional.
@tsibley tsibley mentioned this pull request Jun 16, 2023
1 task
@martindurant
Copy link
Member

I hadn't realised _bz2 was not guranteeed. Thanks for posting this, it'll go in when green.

@martindurant martindurant merged commit aff3f42 into fsspec:master Jun 19, 2023
11 checks passed
@tsibley
Copy link
Contributor Author

tsibley commented Jun 20, 2023

Thanks!

skshetry added a commit to iterative/PyDrive2 that referenced this pull request Jun 22, 2023
skshetry added a commit to iterative/PyDrive2 that referenced this pull request Jun 22, 2023
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