mozversion

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

Library to get version information for Mozilla applications (Firefox, Thunderbird, Fennec, etc.). Current version: 2.4.0. Release cadence: low, last release was in 2017. It reads application.ini and platform.ini to extract version data.

pip install mozversion
error ModuleNotFoundError: No module named 'mozversion'
cause mozversion not installed or installed in a different Python environment.
fix
Run pip install mozversion in your active environment.
error ValueError: No application.ini or platform.ini found
cause The provided path does not point to a valid Mozilla application directory or the files are missing.
fix
Ensure the binary path is correct and that the binary hasn't been removed. Try passing the directory containing the binary instead.
gotcha get_version() expects either a binary path or a directory containing the application. If you pass a directory, ensure it contains application.ini and platform.ini.
fix Always pass the path to the executable binary (e.g., firefox) for best results.
deprecated The library is no longer actively maintained. It may not work with the latest Mozilla application versions (Firefox 60+).
fix Consider using mozversion-1 or parsing application.ini manually if needed.

Retrieves version information from a Mozilla application binary.

from mozversion import get_version

# Replace with path to your Firefox binary or directory
binary = '/usr/lib/firefox/firefox'
try:
    version_info = get_version(binary=binary)
    print(version_info)
except Exception as e:
    print(f'Error: {e}')