Skip to content

guess_format_by_header is buggy #143

@seperman

Description

@seperman

Hello, Snappy Python can't guess the format for its own compressed output:

import io
import snappy
from snappy import snappy_formats

values = b"What is going on?\n"

def snappy_compress_file_obj(in_file, out_file):
    in_file.seek(0)
    result = snappy.compress(in_file.read())
    out_file.write(result)
    out_file.seek(0)


def main():
    file_obj = io.BytesIO(values)
    output_file_obj = io.BytesIO()
    snappy_compress_file_obj(file_obj, output_file_obj)
    snappy_formats.guess_format_by_header(fin=output_file_obj)


if __name__ == '__main__':
    main()

This will throw:

snappy.snappy.UncompressError: Can't detect archive format

Python version: 3.12.3
python-snappy==0.7.1
Ubuntu 20.04 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions