mozprofile
raw JSON → 3.0.0 verified Sat May 09 auth: no python
Library to create and modify Mozilla application profiles. Version 3.0.0 is the latest. Release cadence is irregular, often tied to Mozilla development cycles.
pip install mozprofile Common errors
error ModuleNotFoundError: No module named 'mozprofile' ↓
cause The library was installed in a different Python environment or not installed at all.
fix
Run 'pip install mozprofile' in the correct environment (e.g., virtualenv).
error AttributeError: 'Profile' object has no attribute 'set_preference' ↓
cause Using an older API where set_preference was not a direct method.
fix
Upgrade to latest mozprofile and use FirefoxProfile.set_preference().
error OSError: [Errno 2] No such file or directory: '/tmp/...' ↓
cause The temporary profile directory was deleted prematurely, possibly by a concurrent cleanup.
fix
Ensure no other process is cleaning up the same profile path; call profile.cleanup() only once.
Warnings
breaking In version 3.0.0, the 'Profile' class is no longer directly instantiable; use 'FirefoxProfile' or 'ThunderbirdProfile' instead. ↓
fix Replace Profile() with FirefoxProfile() or appropriate subclass.
deprecated The 'clone_profile' method is deprecated; use 'create_new_profile' with cloning parameters. ↓
fix Use profile.create_new_profile(clone_from=...) instead.
gotcha Profile paths are temporary by default; they are deleted when the Profile object is garbage collected or the script ends. ↓
fix Call profile.cleanup() explicitly if you need to control deletion.
Imports
- Profile wrong
from mozprofile.profile import Profilecorrectfrom mozprofile import Profile - FirefoxProfile
from mozprofile import FirefoxProfile
Quickstart
from mozprofile import FirefoxProfile
profile = FirefoxProfile()
profile.set_preference('browser.startup.homepage', 'https://example.com')
print(profile.profile)