audeer

raw JSON →
2.4.0 verified Fri May 01 auth: no python

audeer is a collection of helpful Python functions for common tasks like file handling, string manipulation, and system operations. Current version: 2.4.0, released roughly monthly. It requires Python >=3.10.

pip install audeer
error ModuleNotFoundError: No module named 'audeer'
cause The package is not installed.
fix
pip install audeer
error AttributeError: module 'audeer' has no attribute 'safe_path'
cause safe_path() was removed in audeer 2.4.0.
fix
Use audeer.safe_filename() instead.
error RuntimeError: Python version <3.10 is not supported by audeer 2.4.0
cause audeer 2.4.0 requires Python 3.10+.
fix
Upgrade Python to 3.10 or higher.
deprecated Function audeer.safe_path() is deprecated in v2.0.0 and removed in v2.4.0; use audeer.safe_filename() instead.
fix Replace audeer.safe_path() with audeer.safe_filename().
breaking Python 3.9 and lower are no longer supported; audeer 2.4.0 requires Python >=3.10.
fix Upgrade Python to 3.10 or later.
gotcha Function audeer.list_file_names() returns full paths by default; use relative=True to get relative paths.
fix Pass relative=True to audeer.list_file_names() if you need relative paths.
gotcha Function audeer.mkdtemp() creates a temporary directory in the system temp location; ensure you clean it up using audeer.rmdir() when done.
fix Use with statement or manually call audeer.rmdir() to clean up.

Basic usage of audeer functions.

import audeer

# Example: list files in a directory
import os
print(audeer.list_file_names('.'))

# Example: make a safe filename
print(audeer.safe_filename('Hello World!'))

# Example: create a temporary directory
tmpdir = audeer.mkdtemp()
print(tmpdir)