doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
os.POSIX_FADV_NORMAL os.POSIX_FADV_SEQUENTIAL os.POSIX_FADV_RANDOM os.POSIX_FADV_NOREUSE os.POSIX_FADV_WILLNEED os.POSIX_FADV_DONTNEED Flags that can be used in advice in posix_fadvise() that specify the access pattern that is likely to be used. Availability: Unix. New in version 3.3.
python.library.os#os.POSIX_FADV_SEQUENTIAL
os.POSIX_FADV_NORMAL os.POSIX_FADV_SEQUENTIAL os.POSIX_FADV_RANDOM os.POSIX_FADV_NOREUSE os.POSIX_FADV_WILLNEED os.POSIX_FADV_DONTNEED Flags that can be used in advice in posix_fadvise() that specify the access pattern that is likely to be used. Availability: Unix. New in version 3.3.
python.library.os#os.POSIX_FADV_WILLNEED
os.posix_fallocate(fd, offset, len) Ensures that enough disk space is allocated for the file specified by fd starting from offset and continuing for len bytes. Availability: Unix. New in version 3.3.
python.library.os#os.posix_fallocate
os.posix_spawn(path, argv, env, *, file_actions=None, setpgroup=None, resetids=False, setsid=False, setsigmask=(), setsigdef=(), scheduler=None) Wraps the posix_spawn() C library API for use from Python. Most users should use subprocess.run() instead of posix_spawn(). The positional-only arguments path, args, and env...
python.library.os#os.posix_spawn
os.posix_spawnp(path, argv, env, *, file_actions=None, setpgroup=None, resetids=False, setsid=False, setsigmask=(), setsigdef=(), scheduler=None) Wraps the posix_spawnp() C library API for use from Python. Similar to posix_spawn() except that the system searches for the executable file in the list of directories spec...
python.library.os#os.posix_spawnp
os.POSIX_SPAWN_CLOSE (os.POSIX_SPAWN_CLOSE, fd) Performs os.close(fd).
python.library.os#os.POSIX_SPAWN_CLOSE
os.POSIX_SPAWN_DUP2 (os.POSIX_SPAWN_DUP2, fd, new_fd) Performs os.dup2(fd, new_fd).
python.library.os#os.POSIX_SPAWN_DUP2
os.POSIX_SPAWN_OPEN (os.POSIX_SPAWN_OPEN, fd, path, flags, mode) Performs os.dup2(os.open(path, flags, mode), fd).
python.library.os#os.POSIX_SPAWN_OPEN
os.pread(fd, n, offset) Read at most n bytes from file descriptor fd at a position of offset, leaving the file offset unchanged. Return a bytestring containing the bytes read. If the end of the file referred to by fd has been reached, an empty bytes object is returned. Availability: Unix. New in version 3.3.
python.library.os#os.pread
os.preadv(fd, buffers, offset, flags=0) Read from a file descriptor fd at a position of offset into mutable bytes-like objects buffers, leaving the file offset unchanged. Transfer data into each buffer until it is full and then move on to the next buffer in the sequence to hold the rest of the data. The flags argumen...
python.library.os#os.preadv
os.PRIO_PROCESS os.PRIO_PGRP os.PRIO_USER Parameters for the getpriority() and setpriority() functions. Availability: Unix. New in version 3.3.
python.library.os#os.PRIO_PGRP
os.PRIO_PROCESS os.PRIO_PGRP os.PRIO_USER Parameters for the getpriority() and setpriority() functions. Availability: Unix. New in version 3.3.
python.library.os#os.PRIO_PROCESS
os.PRIO_PROCESS os.PRIO_PGRP os.PRIO_USER Parameters for the getpriority() and setpriority() functions. Availability: Unix. New in version 3.3.
python.library.os#os.PRIO_USER
os.putenv(key, value) Set the environment variable named key to the string value. Such changes to the environment affect subprocesses started with os.system(), popen() or fork() and execv(). Assignments to items in os.environ are automatically translated into corresponding calls to putenv(); however, calls to putenv(...
python.library.os#os.putenv
os.pwrite(fd, str, offset) Write the bytestring in str to file descriptor fd at position of offset, leaving the file offset unchanged. Return the number of bytes actually written. Availability: Unix. New in version 3.3.
python.library.os#os.pwrite
os.pwritev(fd, buffers, offset, flags=0) Write the buffers contents to file descriptor fd at a offset offset, leaving the file offset unchanged. buffers must be a sequence of bytes-like objects. Buffers are processed in array order. Entire contents of the first buffer is written before proceeding to the second, and s...
python.library.os#os.pwritev
os.P_PID os.P_PGID os.P_ALL These are the possible values for idtype in waitid(). They affect how id is interpreted. Availability: Unix. New in version 3.3.
python.library.os#os.P_ALL
os.P_DETACH os.P_OVERLAY Possible values for the mode parameter to the spawn* family of functions. These are less portable than those listed above. P_DETACH is similar to P_NOWAIT, but the new process is detached from the console of the calling process. If P_OVERLAY is used, the current process will be replaced; th...
python.library.os#os.P_DETACH
os.P_NOWAIT os.P_NOWAITO Possible values for the mode parameter to the spawn* family of functions. If either of these values is given, the spawn*() functions will return as soon as the new process has been created, with the process id as the return value. Availability: Unix, Windows.
python.library.os#os.P_NOWAIT
os.P_NOWAIT os.P_NOWAITO Possible values for the mode parameter to the spawn* family of functions. If either of these values is given, the spawn*() functions will return as soon as the new process has been created, with the process id as the return value. Availability: Unix, Windows.
python.library.os#os.P_NOWAITO
os.P_DETACH os.P_OVERLAY Possible values for the mode parameter to the spawn* family of functions. These are less portable than those listed above. P_DETACH is similar to P_NOWAIT, but the new process is detached from the console of the calling process. If P_OVERLAY is used, the current process will be replaced; th...
python.library.os#os.P_OVERLAY
os.P_PID os.P_PGID os.P_ALL These are the possible values for idtype in waitid(). They affect how id is interpreted. Availability: Unix. New in version 3.3.
python.library.os#os.P_PGID
os.P_PID os.P_PGID os.P_ALL These are the possible values for idtype in waitid(). They affect how id is interpreted. Availability: Unix. New in version 3.3.
python.library.os#os.P_PID
os.P_PIDFD This is a Linux-specific idtype that indicates that id is a file descriptor that refers to a process. Availability: Linux 5.4+ New in version 3.9.
python.library.os#os.P_PIDFD
os.P_WAIT Possible value for the mode parameter to the spawn* family of functions. If this is given as mode, the spawn*() functions will not return until the new process has run to completion and will return the exit code of the process the run is successful, or -signal if a signal kills the process. Availability: Un...
python.library.os#os.P_WAIT
os.read(fd, n) Read at most n bytes from file descriptor fd. Return a bytestring containing the bytes read. If the end of the file referred to by fd has been reached, an empty bytes object is returned. Note This function is intended for low-level I/O and must be applied to a file descriptor as returned by os.open() ...
python.library.os#os.read
os.readlink(path, *, dir_fd=None) Return a string representing the path to which the symbolic link points. The result may be either an absolute or relative pathname; if it is relative, it may be converted to an absolute pathname using os.path.join(os.path.dirname(path), result). If the path is a string object (direct...
python.library.os#os.readlink
os.readv(fd, buffers) Read from a file descriptor fd into a number of mutable bytes-like objects buffers. Transfer data into each buffer until it is full and then move on to the next buffer in the sequence to hold the rest of the data. Return the total number of bytes actually read which can be less than the total ca...
python.library.os#os.readv
os.register_at_fork(*, before=None, after_in_parent=None, after_in_child=None) Register callables to be executed when a new child process is forked using os.fork() or similar process cloning APIs. The parameters are optional and keyword-only. Each specifies a different call point. before is a function called before...
python.library.os#os.register_at_fork
os.remove(path, *, dir_fd=None) Remove (delete) the file path. If path is a directory, an IsADirectoryError is raised. Use rmdir() to remove directories. If the file does not exist, a FileNotFoundError is raised. This function can support paths relative to directory descriptors. On Windows, attempting to remove a fil...
python.library.os#os.remove
os.removedirs(name) Remove directories recursively. Works like rmdir() except that, if the leaf directory is successfully removed, removedirs() tries to successively remove every parent directory mentioned in path until an error is raised (which is ignored, because it generally means that a parent directory is not em...
python.library.os#os.removedirs
os.removexattr(path, attribute, *, follow_symlinks=True) Removes the extended filesystem attribute attribute from path. attribute should be bytes or str (directly or indirectly through the PathLike interface). If it is a string, it is encoded with the filesystem encoding. This function can support specifying a file d...
python.library.os#os.removexattr
os.rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename the file or directory src to dst. If dst exists, the operation will fail with an OSError subclass in a number of cases: On Windows, if dst exists a FileExistsError is always raised. On Unix, if src is a file and dst is a directory or vice-versa, an IsADi...
python.library.os#os.rename
os.renames(old, new) Recursive directory or file renaming function. Works like rename(), except creation of any intermediate directories needed to make the new pathname good is attempted first. After the rename, directories corresponding to rightmost path segments of the old name will be pruned away using removedirs(...
python.library.os#os.renames
os.replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None) Rename the file or directory src to dst. If dst is a directory, OSError will be raised. If dst exists and is a file, it will be replaced silently if the user has permission. The operation may fail if src and dst are on different filesystems. If successful, the...
python.library.os#os.replace
os.rmdir(path, *, dir_fd=None) Remove (delete) the directory path. If the directory does not exist or is not empty, an FileNotFoundError or an OSError is raised respectively. In order to remove whole directory trees, shutil.rmtree() can be used. This function can support paths relative to directory descriptors. Raise...
python.library.os#os.rmdir
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_DEEPBIND
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_GLOBAL
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_LAZY
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_LOCAL
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_NODELETE
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_NOLOAD
os.RTLD_LAZY os.RTLD_NOW os.RTLD_GLOBAL os.RTLD_LOCAL os.RTLD_NODELETE os.RTLD_NOLOAD os.RTLD_DEEPBIND Flags for use with the setdlopenflags() and getdlopenflags() functions. See the Unix manual page dlopen(3) for what the different flags mean. New in version 3.3.
python.library.os#os.RTLD_NOW
os.RWF_DSYNC Provide a per-write equivalent of the O_DSYNC open(2) flag. This flag effect applies only to the data range written by the system call. Availability: Linux 4.7 and newer. New in version 3.7.
python.library.os#os.RWF_DSYNC
os.RWF_HIPRI High priority read/write. Allows block-based filesystems to use polling of the device, which provides lower latency, but may use additional resources. Currently, on Linux, this feature is usable only on a file descriptor opened using the O_DIRECT flag. Availability: Linux 4.6 and newer. New in version 3...
python.library.os#os.RWF_HIPRI
os.RWF_NOWAIT Do not wait for data which is not immediately available. If this flag is specified, the system call will return instantly if it would have to read data from the backing storage or wait for a lock. If some data was successfully read, it will return the number of bytes read. If no bytes were read, it will...
python.library.os#os.RWF_NOWAIT
os.RWF_SYNC Provide a per-write equivalent of the O_SYNC open(2) flag. This flag effect applies only to the data range written by the system call. Availability: Linux 4.7 and newer. New in version 3.7.
python.library.os#os.RWF_SYNC
os.F_OK os.R_OK os.W_OK os.X_OK Values to pass as the mode parameter of access() to test the existence, readability, writability and executability of path, respectively.
python.library.os#os.R_OK
os.scandir(path='.') Return an iterator of os.DirEntry objects corresponding to the entries in the directory given by path. The entries are yielded in arbitrary order, and the special entries '.' and '..' are not included. If a file is removed from or added to the directory after creating the iterator, whether an ent...
python.library.os#os.scandir
scandir.close() Close the iterator and free acquired resources. This is called automatically when the iterator is exhausted or garbage collected, or when an error happens during iterating. However it is advisable to call it explicitly or use the with statement. New in version 3.6.
python.library.os#os.scandir.close
os.SCHED_BATCH Scheduling policy for CPU-intensive processes that tries to preserve interactivity on the rest of the computer.
python.library.os#os.SCHED_BATCH
os.SCHED_FIFO A First In First Out scheduling policy.
python.library.os#os.SCHED_FIFO
os.sched_getaffinity(pid) Return the set of CPUs the process with PID pid (or the current process if zero) is restricted to.
python.library.os#os.sched_getaffinity
os.sched_getparam(pid) Return the scheduling parameters as a sched_param instance for the process with PID pid. A pid of 0 means the calling process.
python.library.os#os.sched_getparam
os.sched_getscheduler(pid) Return the scheduling policy for the process with PID pid. A pid of 0 means the calling process. The result is one of the scheduling policy constants above.
python.library.os#os.sched_getscheduler
os.sched_get_priority_max(policy) Get the maximum priority value for policy. policy is one of the scheduling policy constants above.
python.library.os#os.sched_get_priority_max
os.sched_get_priority_min(policy) Get the minimum priority value for policy. policy is one of the scheduling policy constants above.
python.library.os#os.sched_get_priority_min
os.SCHED_IDLE Scheduling policy for extremely low priority background tasks.
python.library.os#os.SCHED_IDLE
os.SCHED_OTHER The default scheduling policy.
python.library.os#os.SCHED_OTHER
class os.sched_param(sched_priority) This class represents tunable scheduling parameters used in sched_setparam(), sched_setscheduler(), and sched_getparam(). It is immutable. At the moment, there is only one possible parameter: sched_priority The scheduling priority for a scheduling policy.
python.library.os#os.sched_param
sched_priority The scheduling priority for a scheduling policy.
python.library.os#os.sched_param.sched_priority
os.SCHED_RESET_ON_FORK This flag can be OR’ed with any other scheduling policy. When a process with this flag set forks, its child’s scheduling policy and priority are reset to the default.
python.library.os#os.SCHED_RESET_ON_FORK
os.SCHED_RR A round-robin scheduling policy.
python.library.os#os.SCHED_RR
os.sched_rr_get_interval(pid) Return the round-robin quantum in seconds for the process with PID pid. A pid of 0 means the calling process.
python.library.os#os.sched_rr_get_interval
os.sched_setaffinity(pid, mask) Restrict the process with PID pid (or the current process if zero) to a set of CPUs. mask is an iterable of integers representing the set of CPUs to which the process should be restricted.
python.library.os#os.sched_setaffinity
os.sched_setparam(pid, param) Set a scheduling parameters for the process with PID pid. A pid of 0 means the calling process. param is a sched_param instance.
python.library.os#os.sched_setparam
os.sched_setscheduler(pid, policy, param) Set the scheduling policy for the process with PID pid. A pid of 0 means the calling process. policy is one of the scheduling policy constants above. param is a sched_param instance.
python.library.os#os.sched_setscheduler
os.SCHED_SPORADIC Scheduling policy for sporadic server programs.
python.library.os#os.SCHED_SPORADIC
os.sched_yield() Voluntarily relinquish the CPU.
python.library.os#os.sched_yield
os.SEEK_SET os.SEEK_CUR os.SEEK_END Parameters to the lseek() function. Their values are 0, 1, and 2, respectively. New in version 3.3: Some operating systems could support additional values, like os.SEEK_HOLE or os.SEEK_DATA.
python.library.os#os.SEEK_CUR
os.SEEK_SET os.SEEK_CUR os.SEEK_END Parameters to the lseek() function. Their values are 0, 1, and 2, respectively. New in version 3.3: Some operating systems could support additional values, like os.SEEK_HOLE or os.SEEK_DATA.
python.library.os#os.SEEK_END
os.SEEK_SET os.SEEK_CUR os.SEEK_END Parameters to the lseek() function. Their values are 0, 1, and 2, respectively. New in version 3.3: Some operating systems could support additional values, like os.SEEK_HOLE or os.SEEK_DATA.
python.library.os#os.SEEK_SET
os.sendfile(out_fd, in_fd, offset, count) os.sendfile(out_fd, in_fd, offset, count, headers=(), trailers=(), flags=0) Copy count bytes from file descriptor in_fd to file descriptor out_fd starting at offset. Return the number of bytes sent. When EOF is reached return 0. The first function notation is supported by a...
python.library.os#os.sendfile
os.sep The character used by the operating system to separate pathname components. This is '/' for POSIX and '\\' for Windows. Note that knowing this is not sufficient to be able to parse or concatenate pathnames — use os.path.split() and os.path.join() — but it is occasionally useful. Also available via os.path.
python.library.os#os.sep
os.setegid(egid) Set the current process’s effective group id. Availability: Unix.
python.library.os#os.setegid
os.seteuid(euid) Set the current process’s effective user id. Availability: Unix.
python.library.os#os.seteuid
os.setgid(gid) Set the current process’ group id. Availability: Unix.
python.library.os#os.setgid
os.setgroups(groups) Set the list of supplemental group ids associated with the current process to groups. groups must be a sequence, and each element must be an integer identifying a group. This operation is typically available only to the superuser. Availability: Unix. Note On Mac OS X, the length of groups may no...
python.library.os#os.setgroups
os.setpgid(pid, pgrp) Call the system call setpgid() to set the process group id of the process with id pid to the process group with id pgrp. See the Unix manual for the semantics. Availability: Unix.
python.library.os#os.setpgid
os.setpgrp() Call the system call setpgrp() or setpgrp(0, 0) depending on which version is implemented (if any). See the Unix manual for the semantics. Availability: Unix.
python.library.os#os.setpgrp
os.setpriority(which, who, priority) Set program scheduling priority. The value which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and who is interpreted relative to which (a process identifier for PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID for PRIO_USER). A zero value for who denotes (re...
python.library.os#os.setpriority
os.setregid(rgid, egid) Set the current process’s real and effective group ids. Availability: Unix.
python.library.os#os.setregid
os.setresgid(rgid, egid, sgid) Set the current process’s real, effective, and saved group ids. Availability: Unix. New in version 3.2.
python.library.os#os.setresgid
os.setresuid(ruid, euid, suid) Set the current process’s real, effective, and saved user ids. Availability: Unix. New in version 3.2.
python.library.os#os.setresuid
os.setreuid(ruid, euid) Set the current process’s real and effective user ids. Availability: Unix.
python.library.os#os.setreuid
os.setsid() Call the system call setsid(). See the Unix manual for the semantics. Availability: Unix.
python.library.os#os.setsid
os.setuid(uid) Set the current process’s user id. Availability: Unix.
python.library.os#os.setuid
os.setxattr(path, attribute, value, flags=0, *, follow_symlinks=True) 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. flags may ...
python.library.os#os.setxattr
os.set_blocking(fd, blocking) Set the blocking mode of the specified file descriptor. Set the O_NONBLOCK flag if blocking is False, clear the flag otherwise. See also get_blocking() and socket.socket.setblocking(). Availability: Unix. New in version 3.5.
python.library.os#os.set_blocking
os.set_handle_inheritable(handle, inheritable) Set the “inheritable” flag of the specified handle. Availability: Windows.
python.library.os#os.set_handle_inheritable
os.set_inheritable(fd, inheritable) Set the “inheritable” flag of the specified file descriptor.
python.library.os#os.set_inheritable
os.SF_NODISKIO os.SF_MNOWAIT os.SF_SYNC Parameters to the sendfile() function, if the implementation supports them. Availability: Unix. New in version 3.3.
python.library.os#os.SF_MNOWAIT
os.SF_NODISKIO os.SF_MNOWAIT os.SF_SYNC Parameters to the sendfile() function, if the implementation supports them. Availability: Unix. New in version 3.3.
python.library.os#os.SF_NODISKIO
os.SF_NODISKIO os.SF_MNOWAIT os.SF_SYNC Parameters to the sendfile() function, if the implementation supports them. Availability: Unix. New in version 3.3.
python.library.os#os.SF_SYNC
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnl
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnle
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnlp
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnlpe
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnv
os.spawnl(mode, path, ...) os.spawnle(mode, path, ..., env) os.spawnlp(mode, file, ...) os.spawnlpe(mode, file, ..., env) os.spawnv(mode, path, args) os.spawnve(mode, path, args, env) os.spawnvp(mode, file, args) os.spawnvpe(mode, file, args, env) Execute the program path in a new process. (Note that th...
python.library.os#os.spawnve