Skip to content

filetype.guess not working with bytes when used in AWS Lambda environment #194

@miguel-martinr

Description

@miguel-martinr

I've this code that works just fine locally:

file_bytes = file.file.read()
kind = filetype.guess(file_bytes)

file type is UploadFile from FastAPI. So, file.read() returns a bytes object.

I'm using python 3.10 both locally and in AWS Lambda, but for some reason, in the Lambda environment the result from guess is None for any given file.

FWIW: both local and lambda env are using little endian (?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions