ungoogled-software/ungoogled-chromium · error · NotImplementedError
NotImplementedError
Error message
NotImplementedError
What it means
extract_tar_file only implements extractor dispatch for known platforms; when get_running_platform() returns something outside the handled set (macOS/Linux/Windows), the code path raises NotImplementedError(current_platform) to make the unsupported platform explicit instead of guessing.
Source
Thrown at utils/_extraction.py:236
# Use WinRAR if 7-zip is not found
winrar_cmd = extractors.get(ExtractorEnum.WINRAR)
if winrar_cmd == USE_REGISTRY:
winrar_cmd = str(_find_winrar_by_registry())
winrar_bin = _find_extractor_by_cmd(winrar_cmd)
if winrar_bin is not None:
_extract_tar_with_winrar(winrar_bin, archive_path, output_dir, relative_to)
return
get_logger().warning(
'Neither 7-zip nor WinRAR were found. Falling back to Python extractor...')
elif current_platform == PlatformEnum.UNIX:
# NOTE: 7-zip isn't an option because it doesn't preserve file permissions
tar_bin = _find_extractor_by_cmd(extractors.get(ExtractorEnum.TAR))
if not tar_bin is None:
_extract_tar_with_tar(tar_bin, archive_path, output_dir, relative_to)
return
else:
# This is not a normal code path, so make it clear.
raise NotImplementedError(current_platform)
# Fallback to Python-based extractor on all platforms
_extract_tar_with_python(archive_path, output_dir, relative_to)
def extract_with_7z(archive_path, output_dir, relative_to, extractors=None):
"""
Extract archives with 7-zip into the output directory.
Only supports archives with one layer of unpacking, so compressed tar archives don't work.
archive_path is the pathlib.Path to the archive to unpack
output_dir is a pathlib.Path to the directory to unpack. It must already exist.
relative_to is a pathlib.Path for directories that should be stripped relative to the
root of the archive.
extractors is a dictionary of PlatformEnum to a command or path to the
extractor binary. Defaults to 'tar' for tar, and '_use_registry' for 7-Zip.
"""
# TODO: It would be nice to extend this to support arbitrary standard IO chaining of 7zView on GitHub (pinned to f85e84a480)
Solutions
- Run on a supported platform (Linux, macOS, Windows) or set the platform detection to a supported value
- Call extract_with_7z / extract_with_tar-equivalent directly with an explicit extractor path (extractors={ExtractorEnum.TAR: '/usr/bin/tar'})
- Patch/extend the platform dispatch in extract_tar_file for your platform
- Fall back to Python's tarfile module in your own code
Example fix
// before
extract_tar_file(archive, out) # raises NotImplementedError on odd platform
// after
extract_with_7z('/usr/bin/7z', archive, out, extractors={ExtractorEnum.TAR: '/usr/bin/tar'}) Defensive patterns
Strategy: validation
Validate before calling
from utils.platform import get_running_platform
from utils.platform_enum import PlatformEnum
SUPPORTED = {PlatformEnum.LINUX, PlatformEnum.MACOS, PlatformEnum.WINDOWS}
if get_running_platform() not in SUPPORTED:
raise RuntimeError(f'unsupported platform: {get_running_platform()}') Try / catch
try:
extract_tar_file(archive, out, relative_to=rel)
except NotImplementedError as e:
logger.error('platform %s unsupported for tar dispatch: %s', e, e)
raise Prevention
- Verify get_running_platform() value on target platforms before deploying
- Test extraction on all target OSes in CI
- Use explicit extractor configuration on exotic platforms
- Keep platform detection code in sync with supported dispatch table
When it happens
Trigger: Running the library on an OS whose platform detection returns an unhandled value — unusual/unofficial platform strings, exotic platforms like FreeBSD/Alpine with odd detection, or monkeypatched/incorrect platform detection.
Common situations: Packaging for less common platforms (BSD, ChromeOS Linux env with odd uname), embedding the library on non-standard Python distributions where platform detection misfires.
Related errors
AI-assisted analysis of ungoogled-software/ungoogled-chromium@f85e84a480 (2026-08-29).
Data as JSON: /api/errors/6cf50a601d5e19ed.
Report an issue: GitHub.