{"id":27877,"library":"isbinary","title":"IsBinary","description":"A lightweight pure Python package to check if a file is binary or text (fork of binaryornot). Current version 1.0.1, released April 2023. Uses heuristic scanning of a configurable chunk of bytes.","status":"active","version":"1.0.1","language":"python","source_language":"en","source_url":"https://github.com/djmattyg007/python-isbinary","tags":["binary","file-type","text-detection","pure-python"],"install":[{"cmd":"pip install isbinary","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Old import from the original binaryornot library; v1.0.0 broke compatibility and renamed the function.","wrong":"from binaryornot.check import is_binary","symbol":"is_binary_file","correct":"from isbinary import is_binary_file"}],"quickstart":{"code":"from isbinary import is_binary_file\n\nresult = is_binary_file('path/to/file')\nprint(result)  # True if binary, False if text\n\n# Or via CLI: python -m isbinary path/to/file","lang":"python","description":"Basic usage to detect binary vs text file."},"warnings":[{"fix":"Replace `from binaryornot.check import is_binary` with `from isbinary import is_binary_file`.","message":"In v1.0.0 the package name changed from binaryornot to isbinary. All imports must be updated.","severity":"breaking","affected_versions":"≥1.0.0"},{"fix":"Change all calls from `is_binary(path)` to `is_binary_file(path)`.","message":"The function name changed from `is_binary` to `is_binary_file` in v1.0.0.","severity":"breaking","affected_versions":"≥1.0.0"},{"fix":"If needed, adjust chunk size with the `chunk_size` parameter: `is_binary_file(path, chunk_size=1024)`.","message":"The default chunk size increased from 1024 to 2048 bytes. This may affect detection of very small files or performance.","severity":"gotcha","affected_versions":"≥1.0.0"},{"fix":"Ensure you run on Python 3.8 or later.","message":"Python 2 support was removed. Only Python 3.8+ is supported.","severity":"gotcha","affected_versions":"≥1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install isbinary and update imports: `from isbinary import is_binary_file`.","cause":"The old package binaryornot is replaced by isbinary.","error":"ModuleNotFoundError: No module named 'binaryornot'"},{"fix":"Use `from isbinary import is_binary_file`.","cause":"The package was renamed; import path is different.","error":"AttributeError: module 'binaryornot.check' has no attribute 'is_binary'"},{"fix":"Use `from isbinary import is_binary_file` and call `is_binary_file(path)`.","cause":"Function was renamed from is_binary to is_binary_file in v1.0.0.","error":"ImportError: cannot import name 'is_binary' from 'isbinary'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}