On this page
posix.access
Prev: posix.abort | Up: posix | Next: posix.chdir
Rel: posix.abort, posix.chdir, posix.chflags, posix.chmod
Ref: docs.python.org — posix.access
Tags: #public #python3 #stdlib #posix
Import
import posix
from posix import access
Signature & Overview
posix.access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
Use the real uid/gid to test for access to a path.
Usage
import os
assert os.access('.', os.R_OK) is True
Gotchas
- Avoid TOCTOU check-then-open: Prefer
try: open(...) except PermissionError:.
REPL Inspect
from posix import access
help(access)
Linked from
- tuts/python3/stdlib_module/posix
- tuts/python3/stdlib_module/posix/abort
- tuts/python3/stdlib_module/posix/chdir
- tuts/python3/stdlib_module/posix/chflags
- tuts/python3/stdlib_module/posix/chmod
- tuts/python3/stdlib_module/posix/chown
- tuts/python3/stdlib_module/posix/chroot
- tuts/python3/stdlib_module/posix/close
- tuts/python3/stdlib_module/posix/closerange
- tuts/python3/stdlib_module/posix/confstr
- tuts/python3/stdlib_module/posix/cpu_count
- tuts/python3/stdlib_module/posix/ctermid
- tuts/python3/stdlib_module/posix/device_encoding
- tuts/python3/stdlib_module/posix/DirEntry
- tuts/python3/stdlib_module/posix/dup
- tuts/python3/stdlib_module/posix/dup2
- tuts/python3/stdlib_module/posix/error
- tuts/python3/stdlib_module/posix/execv
- tuts/python3/stdlib_module/posix/execve
- tuts/python3/stdlib_module/posix/fchdir
- tuts/python3/stdlib_module/posix/fchmod
- tuts/python3/stdlib_module/posix/fchown
- tuts/python3/stdlib_module/posix/fork
- tuts/python3/stdlib_module/posix/forkpty
- tuts/python3/stdlib_module/posix/fpathconf
- tuts/python3/stdlib_module/posix/fspath
- tuts/python3/stdlib_module/posix/fstat
- tuts/python3/stdlib_module/posix/fstatvfs
- tuts/python3/stdlib_module/posix/fsync
- tuts/python3/stdlib_module/posix/ftruncate
- tuts/python3/stdlib_module/posix/get_blocking
- tuts/python3/stdlib_module/posix/get_inheritable
- tuts/python3/stdlib_module/posix/get_terminal_size
- tuts/python3/stdlib_module/posix/getcwd
- tuts/python3/stdlib_module/posix/getcwdb
- tuts/python3/stdlib_module/posix/getegid
- tuts/python3/stdlib_module/posix/geteuid
- tuts/python3/stdlib_module/posix/stat_result
- tuts/python3/stdlib_module/posix/statvfs_result
- tuts/python3/stdlib_module/posix/terminal_size
- tuts/python3/stdlib_module/posix/times_result
- tuts/python3/stdlib_module/posix/uname_result
- tuts/python3/stdlib_module/posix/waitid_result
Related notes
- tuts/python3/stdlib_module/posix/abort Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chdir Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chflags Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chmod Linked here; links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posix/chown links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/chroot links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/close links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/closerange links to this page; shared tags: #posix, #stdlib
- tuts/python3/stdlib_module/posix/confstr links to this page; shared tags: #posix, #stdlib