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 are similar to execve(). The path parameter is the path to the executable file. The path should contain a directory. Use posix_spawnp() to pass an executable file without directory. The file_actions argument may be a sequence of tuples describing actions to take on specific file descriptors in the child process between the C library implementation’s fork() and exec() steps. The first item in each tuple must be one of the three type indicator listed below describing the remaining tuple elements: os.POSIX_SPAWN_OPEN (os.POSIX_SPAWN_OPEN, fd, path, flags, mode) Performs os.dup2(os.open(path, flags, mode), fd). os.POSIX_SPAWN_CLOSE (os.POSIX_SPAWN_CLOSE, fd) Performs os.close(fd). os.POSIX_SPAWN_DUP2 (os.POSIX_SPAWN_DUP2, fd, new_fd) Performs os.dup2(fd, new_fd). These tuples correspond to the C library posix_spawn_file_actions_addopen(), posix_spawn_file_actions_addclose(), and posix_spawn_file_actions_adddup2() API calls used to prepare for the posix_spawn() call itself. The setpgroup argument will set the process group of the child to the value specified. If the value specified is 0, the child’s process group ID will be made the same as its process ID. If the value of setpgroup is not set, the child will inherit the parent’s process group ID. This argument corresponds to the C library POSIX_SPAWN_SETPGROUP flag. If the resetids argument is True it will reset the effective UID and GID of the child to the real UID and GID of the parent process. If the argument is False, then the child retains the effective UID and GID of the parent. In either case, if the set-user-ID and set-group-ID permission bits are enabled on the executable file, their effect will override the setting of the effective UID and GID. This argument corresponds to the C library POSIX_SPAWN_RESETIDS flag. If the setsid argument is True, it will create a new session ID for posix_spawn. setsid requires POSIX_SPAWN_SETSID or POSIX_SPAWN_SETSID_NP flag. Otherwise, NotImplementedError is raised. The setsigmask argument will set the signal mask to the signal set specified. If the parameter is not used, then the child inherits the parent’s signal mask. This argument corresponds to the C library POSIX_SPAWN_SETSIGMASK flag. The sigdef argument will reset the disposition of all signals in the set specified. This argument corresponds to the C library POSIX_SPAWN_SETSIGDEF flag. The scheduler argument must be a tuple containing the (optional) scheduler policy and an instance of sched_param with the scheduler parameters. A value of None in the place of the scheduler policy indicates that is not being provided. This argument is a combination of the C library POSIX_SPAWN_SETSCHEDPARAM and POSIX_SPAWN_SETSCHEDULER flags. Raises an auditing event os.posix_spawn with arguments path, argv, env. New in version 3.8. Availability: Unix.
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 specified by the PATH environment variable (in the same way as for execvp(3)). Raises an auditing event os.posix_spawn with arguments path, argv, env. New in version 3.8. Availability: See posix_spawn() documentation.
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 argument contains a bitwise OR of zero or more of the following flags: RWF_HIPRI RWF_NOWAIT Return the total number of bytes actually read which can be less than the total capacity of all the objects. The operating system may set a limit (sysconf() value 'SC_IOV_MAX') on the number of buffers that can be used. Combine the functionality of os.readv() and os.pread(). Availability: Linux 2.6.30 and newer, FreeBSD 6.0 and newer, OpenBSD 2.7 and newer, AIX 7.1 and newer. Using flags requires Linux 4.6 or newer. New in version 3.7.
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() don’t update os.environ, so it is actually preferable to assign to items of os.environ. Note On some platforms, including FreeBSD and Mac OS X, setting environ may cause memory leaks. Refer to the system documentation for putenv(). Raises an auditing event os.putenv with arguments key, value. Changed in version 3.9: The function is now always available.
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 so on. The flags argument contains a bitwise OR of zero or more of the following flags: RWF_DSYNC RWF_SYNC Return the total number of bytes actually written. The operating system may set a limit (sysconf() value 'SC_IOV_MAX') on the number of buffers that can be used. Combine the functionality of os.writev() and os.pwrite(). Availability: Linux 2.6.30 and newer, FreeBSD 6.0 and newer, OpenBSD 2.7 and newer, AIX 7.1 and newer. Using flags requires Linux 4.7 or newer. New in version 3.7.
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; the spawn* function will not return. Availability: Windows.
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; the spawn* function will not return. Availability: Windows.
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: Unix, Windows.
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() or pipe(). To read a “file object” returned by the built-in function open() or by popen() or fdopen(), or sys.stdin, use its read() or readline() methods. Changed in version 3.5: If the system call is interrupted and the signal handler does not raise an exception, the function now retries the system call instead of raising an InterruptedError exception (see PEP 475 for the rationale).
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 (directly or indirectly through a PathLike interface), the result will also be a string object, and the call may raise a UnicodeDecodeError. If the path is a bytes object (direct or indirectly), the result will be a bytes object. This function can also support paths relative to directory descriptors. When trying to resolve a path that may contain links, use realpath() to properly handle recursion and platform differences. Availability: Unix, Windows. Changed in version 3.2: Added support for Windows 6.0 (Vista) symbolic links. New in version 3.3: The dir_fd argument. Changed in version 3.6: Accepts a path-like object on Unix. Changed in version 3.8: Accepts a path-like object and a bytes object on Windows. Changed in version 3.8: Added support for directory junctions, and changed to return the substitution path (which typically includes \\?\ prefix) rather than the optional “print name” field that was previously returned.
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 capacity of all the objects. The operating system may set a limit (sysconf() value 'SC_IOV_MAX') on the number of buffers that can be used. Availability: Unix. New in version 3.3.
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 forking a child process. after_in_parent is a function called from the parent process after forking a child process. after_in_child is a function called from the child process. These calls are only made if control is expected to return to the Python interpreter. A typical subprocess launch will not trigger them as the child is not going to re-enter the interpreter. Functions registered for execution before forking are called in reverse registration order. Functions registered for execution after forking (either in the parent or in the child) are called in registration order. Note that fork() calls made by third-party C code may not call those functions, unless it explicitly calls PyOS_BeforeFork(), PyOS_AfterFork_Parent() and PyOS_AfterFork_Child(). There is no way to unregister a function. Availability: Unix. New in version 3.7.
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 file that is in use causes an exception to be raised; on Unix, the directory entry is removed but the storage allocated to the file is not made available until the original file is no longer in use. This function is semantically identical to unlink(). Raises an auditing event os.remove with arguments path, dir_fd. New in version 3.3: The dir_fd argument. Changed in version 3.6: Accepts a path-like object.
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 empty). For example, os.removedirs('foo/bar/baz') will first remove the directory 'foo/bar/baz', and then remove 'foo/bar' and 'foo' if they are empty. Raises OSError if the leaf directory could not be successfully removed. Raises an auditing event os.remove with arguments path, dir_fd. Changed in version 3.6: Accepts a path-like object.
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 descriptor and not following symlinks. Raises an auditing event os.removexattr with arguments path, attribute. Changed in version 3.6: Accepts a path-like object for path and attribute.
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 IsADirectoryError or a NotADirectoryError will be raised respectively. If both are directories and dst is empty, dst will be silently replaced. If dst is a non-empty directory, an OSError is raised. If both are files, dst it will be replaced silently if the user has permission. The operation may fail on some Unix flavors if src and dst are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). This function can support specifying src_dir_fd and/or dst_dir_fd to supply paths relative to directory descriptors. If you want cross-platform overwriting of the destination, use replace(). Raises an auditing event os.rename with arguments src, dst, src_dir_fd, dst_dir_fd. New in version 3.3: The src_dir_fd and dst_dir_fd arguments. Changed in version 3.6: Accepts a path-like object for src and dst.
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(). Note This function can fail with the new directory structure made if you lack permissions needed to remove the leaf directory or file. Raises an auditing event os.rename with arguments src, dst, src_dir_fd, dst_dir_fd. Changed in version 3.6: Accepts a path-like object for old and new.
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 renaming will be an atomic operation (this is a POSIX requirement). This function can support specifying src_dir_fd and/or dst_dir_fd to supply paths relative to directory descriptors. Raises an auditing event os.rename with arguments src, dst, src_dir_fd, dst_dir_fd. New in version 3.3. Changed in version 3.6: Accepts a path-like object for src and dst.
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. Raises an auditing event os.rmdir with arguments path, dir_fd. New in version 3.3: The dir_fd parameter. Changed in version 3.6: Accepts a path-like object.
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.7.
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 return -1 and set errno to errno.EAGAIN. Availability: Linux 4.14 and newer. New in version 3.7.
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 entry for that file be included is unspecified. Using scandir() instead of listdir() can significantly increase the performance of code that also needs file type or file attribute information, because os.DirEntry objects expose this information if the operating system provides it when scanning a directory. All os.DirEntry methods may perform a system call, but is_dir() and is_file() usually only require a system call for symbolic links; os.DirEntry.stat() always requires a system call on Unix but only requires one for symbolic links on Windows. path may be a path-like object. If path is of type bytes (directly or indirectly through the PathLike interface), the type of the name and path attributes of each os.DirEntry will be bytes; in all other circumstances, they will be of type str. This function can also support specifying a file descriptor; the file descriptor must refer to a directory. Raises an auditing event os.scandir with argument path. The scandir() iterator supports the context manager protocol and has the following method: 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. The following example shows a simple use of scandir() to display all the files (excluding directories) in the given path that don’t start with '.'. The entry.is_file() call will generally not make an additional system call: with os.scandir(path) as it: for entry in it: if not entry.name.startswith('.') and entry.is_file(): print(entry.name) Note On Unix-based systems, scandir() uses the system’s opendir() and readdir() functions. On Windows, it uses the Win32 FindFirstFileW and FindNextFileW functions. New in version 3.5. New in version 3.6: Added support for the context manager protocol and the close() method. If a scandir() iterator is neither exhausted nor explicitly closed a ResourceWarning will be emitted in its destructor. The function accepts a path-like object. Changed in version 3.7: Added support for file descriptors on Unix.
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 all platforms that define sendfile(). On Linux, if offset is given as None, the bytes are read from the current position of in_fd and the position of in_fd is updated. The second case may be used on Mac OS X and FreeBSD where headers and trailers are arbitrary sequences of buffers that are written before and after the data from in_fd is written. It returns the same as the first case. On Mac OS X and FreeBSD, a value of 0 for count specifies to send until the end of in_fd is reached. All platforms support sockets as out_fd file descriptor, and some platforms allow other types (e.g. regular file, pipe) as well. Cross-platform applications should not use headers, trailers and flags arguments. Availability: Unix. Note For a higher-level wrapper of sendfile(), see socket.socket.sendfile(). New in version 3.3. Changed in version 3.9: Parameters out and in was renamed to out_fd and in_fd.
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 not exceed the system-defined maximum number of effective group ids, typically 16. See the documentation for getgroups() for cases where it may not return the same group list set by calling setgroups().
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 (respectively) the calling process, the process group of the calling process, or the real user ID of the calling process. priority is a value in the range -20 to 19. The default priority is 0; lower priorities cause more favorable scheduling. Availability: Unix. New in version 3.3.
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 be XATTR_REPLACE or XATTR_CREATE. If XATTR_REPLACE is given and the attribute does not exist, EEXISTS will be raised. If XATTR_CREATE is given and the attribute already exists, the attribute will not be created and ENODATA will be raised. This function can support specifying a file descriptor and not following symlinks. Note A bug in Linux kernel versions less than 2.6.39 caused the flags argument to be ignored on some filesystems. Raises an auditing event os.setxattr with arguments path, attribute, value, flags. Changed in version 3.6: Accepts a path-like object for path and attribute.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
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 the subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using these functions. Check especially the Replacing Older Functions with the subprocess Module section.) If mode is P_NOWAIT, this function returns the process id of the new process; if mode is P_WAIT, returns the process’s exit code if it exits normally, or -signal, where signal is the signal that killed the process. On Windows, the process id will actually be the process handle, so can be used with the waitpid() function. Note on VxWorks, this function doesn’t return -signal when the new process is killed. Instead it raises OSError exception. The “l” and “v” variants of the spawn* functions differ in how command-line arguments are passed. The “l” variants are perhaps the easiest to work with if the number of parameters is fixed when the code is written; the individual parameters simply become additional parameters to the spawnl*() functions. The “v” variants are good when the number of parameters is variable, with the arguments being passed in a list or tuple as the args parameter. In either case, the arguments to the child process must start with the name of the command being run. The variants which include a second “p” near the end (spawnlp(), spawnlpe(), spawnvp(), and spawnvpe()) will use the PATH environment variable to locate the program file. When the environment is being replaced (using one of the spawn*e variants, discussed in the next paragraph), the new environment is used as the source of the PATH variable. The other variants, spawnl(), spawnle(), spawnv(), and spawnve(), will not use the PATH variable to locate the executable; path must contain an appropriate absolute or relative path. For spawnle(), spawnlpe(), spawnve(), and spawnvpe() (note that these all end in “e”), the env parameter must be a mapping which is used to define the environment variables for the new process (they are used instead of the current process’ environment); the functions spawnl(), spawnlp(), spawnv(), and spawnvp() all cause the new process to inherit the environment of the current process. Note that keys and values in the env dictionary must be strings; invalid keys or values will cause the function to fail, with a return value of 127. As an example, the following calls to spawnlp() and spawnvpe() are equivalent: import os os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null') L = ['cp', 'index.html', '/dev/null'] os.spawnvpe(os.P_WAIT, 'cp', L, os.environ) Raises an auditing event os.spawn with arguments mode, path, args, env. Availability: Unix, Windows. spawnlp(), spawnlpe(), spawnvp() and spawnvpe() are not available on Windows. spawnle() and spawnve() are not thread-safe on Windows; we advise you to use the subprocess module instead. Changed in version 3.6: Accepts a path-like object.
python.library.os#os.spawnve