extractcode

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

A mostly universal archive extractor using 7zip, libarchive and the Python standard library for reliable archive extraction. Current version 31.0.0, requires Python >=3.6. Released as part of the scancode-toolkit ecosystem.

pip install extractcode
error ModuleNotFoundError: No module named 'extractcode.api'
cause Installed an older version (<31.0.0) where the API module did not exist or was named differently.
fix
Upgrade to the latest version: pip install --upgrade extractcode
error ImportError: cannot import name 'extract_archive' from 'extractcode'
cause Attempting to import directly from the top-level package instead of the api submodule.
fix
from extractcode.api import extract_archive
error AttributeError: module 'extractcode' has no attribute 'extract'
cause Using an old API (e.g., `extractcode.extract()`) that was removed in recent versions.
fix
Use from extractcode.api import extract_archive and call extract_archive().
breaking In v31.0.0, patch extraction is no longer installed by default. Use the [patch] extra to include patch.py support.
fix pip install extractcode[patch]
gotcha The main extraction function `extract_archive` is located in the `extractcode.api` module, not in the top-level `extractcode` package. Importing from the top level will raise ImportError.
fix Use `from extractcode.api import extract_archive`.
deprecated Older versions used `extractcode.extract()` or similar functions that are now removed. Check the API for the current interface.
fix Upgrade to v31.0.0 and use `from extractcode.api import extract_archive`.
pip install extractcode[patch]

Basic usage: extract an archive file to a directory.

from extractcode.api import extract_archive

# Extract an archive to a destination directory
extract_archive('sample.zip', dest_dir='/tmp/extracted', verbose=True)