{"library":"oschmod","title":"oschmod: Cross-platform file permissions","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install oschmod"],"cli":null},"imports":["from oschmod import oschmod"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom oschmod import oschmod\n\n# Create a dummy file for demonstration\nfile_path = 'my_test_file.txt'\nwith open(file_path, 'w') as f:\n    f.write('Hello, oschmod!')\n\nprint(f\"Initial permissions for {file_path}: {oct(os.stat(file_path).st_mode & 0o777)}\")\n\n# Set permissions to rwxr-xr-x (0o755)\noschmod(file_path, 0o755)\n\nprint(f\"New permissions for {file_path}: {oct(os.stat(file_path).st_mode & 0o777)}\")\n\n# Clean up the dummy file\nos.remove(file_path)\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}