mozfile is a Python convenience library providing robust file utilities primarily for use in Mozilla's automated testing environments. It offers enhanced replacements for standard library functions like `shutil.move` and `shutil.rmtree`, designed to handle common issues like file locking on Windows. The current stable version is 3.0.0, released in October 2022, with a stable but infrequent release cadence.
pip install mozfileNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core utilities of `mozfile`: `move` and `remove`. These functions offer enhanced reliability over standard `shutil` operations, particularly in test environments and on Windows where file locking can be problematic. The `remove` function notably does not raise an error if the path does not exist.
Explicitly check `os.path.exists()` before calling `mozfile.remove()` if you need to ensure the path existed, or adjust error handling to account for silent removal of non-existent paths.
Thoroughly test existing code after migrating from `shutil` to `mozfile` to ensure compatibility with altered error handling and retry logic, especially for non-Windows environments where `shutil` might be sufficient.
Consult `mozbase`'s official documentation and conduct comprehensive regression testing when upgrading to 3.0.0 from older major versions to identify any subtle behavior changes.
Use `mozfile.move()` or `mozfile.remove()` instead of `shutil.move()` or `shutil.rmtree()`. `mozfile` includes retry logic for such errors, significantly improving reliability in these situations.
Switch to `mozfile.move()` or `mozfile.remove()`. These functions are designed to mitigate these common permission/access denial issues by retrying the operation with a delay.
No traffic data recorded yet.