oschmod is a Python library that provides a Windows and Linux compatible `chmod` function for managing file permissions. It aims to offer a consistent API for setting POSIX-like permissions across various operating systems, including Windows, which natively uses Access Control Lists (ACLs) rather than POSIX mode bits. The current version is 0.3.12, and it maintains a moderate release cadence primarily for bug fixes and compatibility updates.
pip install oschmodVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `oschmod` function to set file permissions. It creates a temporary file, sets its permissions to 0o755 (read, write, execute for owner; read, execute for group and others), and then verifies the change. Remember to use an octal literal (e.g., `0o755`) for the mode.
Be aware of potential differences in permission interpretation on Windows. For fine-grained Windows permissions, consider using a dedicated ACL management library.
Implement directory traversal logic using `os.walk` or similar methods if you need to set permissions recursively for a directory's contents.
Ensure the script is run with appropriate user privileges (e.g., administrator on Windows, root or sudo on Linux) or verify the current user has ownership/write permissions for the target file/directory.
No dependency data recorded yet.