ID EN
OS

setxattr

Python 3.11

Set the extended filesystem attribute attribute on path to value. attribute must be a bytes or str with no embedded NULs (directly or indirectly through the PathLike interface). If it is a str, it is encoded with the filesystem encoding and error handler. flags may be XATTR_REPLACE or XATTR_CREATE. If XATTR_REPLACE is given and the attribute does not exist, ENODATA will be raised. If XATTR_CREATE is given and the attribute already exists, the attribute will not be created and EEXISTS will be raised.

Syntax

PYTHON
os.setxattr(path, attribute, value, flags=0, *, follow_symlinks=True)

See Also

PathLike filesystem encoding and error handler XATTR_REPLACE XATTR_CREATE XATTR_REPLACE XATTR_CREATE specifying a file descriptor not following symlinks