fzflib

raw JSON →
0.1.17 verified Sat May 09 auth: no python

A Python library for interacting with FZF (fuzzy finder) by wrapping its command-line interface. Currently at version 0.1.17, with infrequent releases. Requires Python >=3.6.

pip install fzflib
error FileNotFoundError: [Errno 2] No such file or directory: 'fzf'
cause The `fzf` binary is not installed or not on the system PATH.
fix
Install fzf: https://github.com/junegunn/fzf#installation
error AttributeError: 'Fzf' object has no attribute 'run'
cause Using an older version of fzflib where the method was named differently or the class was not imported correctly.
fix
Ensure you have version 0.1.x installed and use from fzflib import Fzf.
error TypeError: 'tuple' object is not callable
cause Using parentheses after `fzf.run` instead of calling with arguments correctly, e.g., `fzf.run(['a'])` vs `fzf.run(('a'))`.
fix
Pass a list (or iterable) as the first argument to run(), e.g., fzf.run(['a']).
gotcha The `Fzf` object runs an external `fzf` process; ensure `fzf` is installed and on PATH, otherwise it will fail silently or raise an error.
fix Install fzf (e.g., `brew install fzf` on macOS, or via your package manager) before using fzflib.
deprecated Direct access to internal attributes like `process.pid` may change in future versions; prefer using methods like `wait()` or `close()`.
fix Use the public API methods instead of directly accessing subprocess internals.
gotcha The `run` method returns a `ProcessResult` object; calling `.output` returns a list of strings, not a single string. Using `.stdout` may be confused with raw bytes.
fix Use `.output` to get the list of selected items, or `.raw_lines()` for more control.

Basic usage: create an Fzf instance and call run() with a list of choices.

from fzflib import Fzf

fzf = Fzf()
result = fzf.run(['option1', 'option2', 'option3']).output
print(result)