is_binary_file

sherpa.utils.is_binary_file(filename)[source] [edit on github]

Estimate if a file is a binary file.

Parameters

filename (str) – The name of the file.

Returns

flag – Returns True if a non-printable character is found in the first 1024 bytes of the file.

Return type

bool

Notes

For this function, “binary” means the file contains a non-ASCII character.