doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
os.dup2(fd, fd2, inheritable=True)
Duplicate file descriptor fd to fd2, closing the latter first if necessary. Return fd2. The new file descriptor is inheritable by default or non-inheritable if inheritable is False. Changed in version 3.4: Add the optional inheritable parameter. Changed in version 3.7: Return fd2... | python.library.os#os.dup2 |
os.environ
A mapping object representing the string environment. For example, environ['HOME'] is the pathname of your home directory (on some platforms), and is equivalent to getenv("HOME") in C. This mapping is captured the first time the os module is imported, typically during Python startup as part of processing s... | python.library.os#os.environ |
os.environb
Bytes version of environ: a mapping object representing the environment as byte strings. environ and environb are synchronized (modify environb updates environ, and vice versa). environb is only available if supports_bytes_environ is True. New in version 3.2. Changed in version 3.9: Updated to support ... | python.library.os#os.environb |
exception os.error
An alias for the built-in OSError exception. | python.library.os#os.error |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execl |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execle |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execlp |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execlpe |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execv |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execve |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execvp |
os.execl(path, arg0, arg1, ...)
os.execle(path, arg0, arg1, ..., env)
os.execlp(file, arg0, arg1, ...)
os.execlpe(file, arg0, arg1, ..., env)
os.execv(path, args)
os.execve(path, args, env)
os.execvp(file, args)
os.execvpe(file, args, env)
These functions all execute a new program, replacing the current... | python.library.os#os.execvpe |
os.extsep
The character which separates the base filename from the extension; for example, the '.' in os.py. Also available via os.path. | python.library.os#os.extsep |
os.EX_CANTCREAT
Exit code that means a user specified output file could not be created. Availability: Unix. | python.library.os#os.EX_CANTCREAT |
os.EX_CONFIG
Exit code that means that some kind of configuration error occurred. Availability: Unix. | python.library.os#os.EX_CONFIG |
os.EX_DATAERR
Exit code that means the input data was incorrect. Availability: Unix. | python.library.os#os.EX_DATAERR |
os.EX_IOERR
Exit code that means that an error occurred while doing I/O on some file. Availability: Unix. | python.library.os#os.EX_IOERR |
os.EX_NOHOST
Exit code that means a specified host did not exist. Availability: Unix. | python.library.os#os.EX_NOHOST |
os.EX_NOINPUT
Exit code that means an input file did not exist or was not readable. Availability: Unix. | python.library.os#os.EX_NOINPUT |
os.EX_NOPERM
Exit code that means that there were insufficient permissions to perform the operation (but not intended for file system problems). Availability: Unix. | python.library.os#os.EX_NOPERM |
os.EX_NOTFOUND
Exit code that means something like “an entry was not found”. Availability: Unix. | python.library.os#os.EX_NOTFOUND |
os.EX_NOUSER
Exit code that means a specified user did not exist. Availability: Unix. | python.library.os#os.EX_NOUSER |
os.EX_OK
Exit code that means no error occurred. Availability: Unix. | python.library.os#os.EX_OK |
os.EX_OSERR
Exit code that means an operating system error was detected, such as the inability to fork or create a pipe. Availability: Unix. | python.library.os#os.EX_OSERR |
os.EX_OSFILE
Exit code that means some system file did not exist, could not be opened, or had some other kind of error. Availability: Unix. | python.library.os#os.EX_OSFILE |
os.EX_PROTOCOL
Exit code that means that a protocol exchange was illegal, invalid, or not understood. Availability: Unix. | python.library.os#os.EX_PROTOCOL |
os.EX_SOFTWARE
Exit code that means an internal software error was detected. Availability: Unix. | python.library.os#os.EX_SOFTWARE |
os.EX_TEMPFAIL
Exit code that means a temporary failure occurred. This indicates something that may not really be an error, such as a network connection that couldn’t be made during a retryable operation. Availability: Unix. | python.library.os#os.EX_TEMPFAIL |
os.EX_UNAVAILABLE
Exit code that means that a required service is unavailable. Availability: Unix. | python.library.os#os.EX_UNAVAILABLE |
os.EX_USAGE
Exit code that means the command was used incorrectly, such as when the wrong number of arguments are given. Availability: Unix. | python.library.os#os.EX_USAGE |
os.fchdir(fd)
Change the current working directory to the directory represented by the file descriptor fd. The descriptor must refer to an opened directory, not an open file. As of Python 3.3, this is equivalent to os.chdir(fd). Raises an auditing event os.chdir with argument path. Availability: Unix. | python.library.os#os.fchdir |
os.fchmod(fd, mode)
Change the mode of the file given by fd to the numeric mode. See the docs for chmod() for possible values of mode. As of Python 3.3, this is equivalent to os.chmod(fd, mode). Raises an auditing event os.chmod with arguments path, mode, dir_fd. Availability: Unix. | python.library.os#os.fchmod |
os.fchown(fd, uid, gid)
Change the owner and group id of the file given by fd to the numeric uid and gid. To leave one of the ids unchanged, set it to -1. See chown(). As of Python 3.3, this is equivalent to os.chown(fd, uid,
gid). Raises an auditing event os.chown with arguments path, uid, gid, dir_fd. Availability:... | python.library.os#os.fchown |
os.fdatasync(fd)
Force write of file with filedescriptor fd to disk. Does not force update of metadata. Availability: Unix. Note This function is not available on MacOS. | python.library.os#os.fdatasync |
os.fdopen(fd, *args, **kwargs)
Return an open file object connected to the file descriptor fd. This is an alias of the open() built-in function and accepts the same arguments. The only difference is that the first argument of fdopen() must always be an integer. | python.library.os#os.fdopen |
os.fork()
Fork a child process. Return 0 in the child and the child’s process id in the parent. If an error occurs OSError is raised. Note that some platforms including FreeBSD <= 6.3 and Cygwin have known issues when using fork() from a thread. Raises an auditing event os.fork with no arguments. Changed in version ... | python.library.os#os.fork |
os.forkpty()
Fork a child process, using a new pseudo-terminal as the child’s controlling terminal. Return a pair of (pid, fd), where pid is 0 in the child, the new child’s process id in the parent, and fd is the file descriptor of the master end of the pseudo-terminal. For a more portable approach, use the pty modul... | python.library.os#os.forkpty |
os.fpathconf(fd, name)
Return system configuration information relevant to an open file. name specifies the configuration value to retrieve; it may be a string which is the name of a defined system value; these names are specified in a number of standards (POSIX.1, Unix 95, Unix 98, and others). Some platforms define... | python.library.os#os.fpathconf |
os.fsdecode(filename)
Decode the path-like filename from the filesystem encoding with 'surrogateescape' error handler, or 'strict' on Windows; return str unchanged. fsencode() is the reverse function. New in version 3.2. Changed in version 3.6: Support added to accept objects implementing the os.PathLike interface... | python.library.os#os.fsdecode |
os.fsencode(filename)
Encode path-like filename to the filesystem encoding with 'surrogateescape' error handler, or 'strict' on Windows; return bytes unchanged. fsdecode() is the reverse function. New in version 3.2. Changed in version 3.6: Support added to accept objects implementing the os.PathLike interface. | python.library.os#os.fsencode |
os.fspath(path)
Return the file system representation of the path. If str or bytes is passed in, it is returned unchanged. Otherwise __fspath__() is called and its value is returned as long as it is a str or bytes object. In all other cases, TypeError is raised. New in version 3.6. | python.library.os#os.fspath |
os.fstat(fd)
Get the status of the file descriptor fd. Return a stat_result object. As of Python 3.3, this is equivalent to os.stat(fd). See also The stat() function. | python.library.os#os.fstat |
os.fstatvfs(fd)
Return information about the filesystem containing the file associated with file descriptor fd, like statvfs(). As of Python 3.3, this is equivalent to os.statvfs(fd). Availability: Unix. | python.library.os#os.fstatvfs |
os.fsync(fd)
Force write of file with filedescriptor fd to disk. On Unix, this calls the native fsync() function; on Windows, the MS _commit() function. If you’re starting with a buffered Python file object f, first do f.flush(), and then do os.fsync(f.fileno()), to ensure that all internal buffers associated with f ... | python.library.os#os.fsync |
os.ftruncate(fd, length)
Truncate the file corresponding to file descriptor fd, so that it is at most length bytes in size. As of Python 3.3, this is equivalent to os.truncate(fd, length). Raises an auditing event os.truncate with arguments fd, length. Availability: Unix, Windows. Changed in version 3.5: Added suppo... | python.library.os#os.ftruncate |
os.fwalk(top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)
This behaves exactly like walk(), except that it yields a 4-tuple (dirpath, dirnames, filenames, dirfd), and it supports dir_fd. dirpath, dirnames and filenames are identical to walk() output, and dirfd is a file descriptor referring... | python.library.os#os.fwalk |
os.F_LOCK
os.F_TLOCK
os.F_ULOCK
os.F_TEST
Flags that specify what action lockf() will take. Availability: Unix. New in version 3.3. | python.library.os#os.F_LOCK |
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.F_OK |
os.F_LOCK
os.F_TLOCK
os.F_ULOCK
os.F_TEST
Flags that specify what action lockf() will take. Availability: Unix. New in version 3.3. | python.library.os#os.F_TEST |
os.F_LOCK
os.F_TLOCK
os.F_ULOCK
os.F_TEST
Flags that specify what action lockf() will take. Availability: Unix. New in version 3.3. | python.library.os#os.F_TLOCK |
os.F_LOCK
os.F_TLOCK
os.F_ULOCK
os.F_TEST
Flags that specify what action lockf() will take. Availability: Unix. New in version 3.3. | python.library.os#os.F_ULOCK |
os.getcwd()
Return a string representing the current working directory. | python.library.os#os.getcwd |
os.getcwdb()
Return a bytestring representing the current working directory. Changed in version 3.8: The function now uses the UTF-8 encoding on Windows, rather than the ANSI code page: see PEP 529 for the rationale. The function is no longer deprecated on Windows. | python.library.os#os.getcwdb |
os.getegid()
Return the effective group id of the current process. This corresponds to the “set id” bit on the file being executed in the current process. Availability: Unix. | python.library.os#os.getegid |
os.getenv(key, default=None)
Return the value of the environment variable key if it exists, or default if it doesn’t. key, default and the result are str. On Unix, keys and values are decoded with sys.getfilesystemencoding() and 'surrogateescape' error handler. Use os.getenvb() if you would like to use a different en... | python.library.os#os.getenv |
os.getenvb(key, default=None)
Return the value of the environment variable key if it exists, or default if it doesn’t. key, default and the result are bytes. getenvb() is only available if supports_bytes_environ is True. Availability: most flavors of Unix. New in version 3.2. | python.library.os#os.getenvb |
os.geteuid()
Return the current process’s effective user id. Availability: Unix. | python.library.os#os.geteuid |
os.getgid()
Return the real group id of the current process. Availability: Unix. | python.library.os#os.getgid |
os.getgrouplist(user, group)
Return list of group ids that user belongs to. If group is not in the list, it is included; typically, group is specified as the group ID field from the password record for user. Availability: Unix. New in version 3.3. | python.library.os#os.getgrouplist |
os.getgroups()
Return list of supplemental group ids associated with the current process. Availability: Unix. Note On Mac OS X, getgroups() behavior differs somewhat from other Unix platforms. If the Python interpreter was built with a deployment target of 10.5 or earlier, getgroups() returns the list of effective g... | python.library.os#os.getgroups |
os.getloadavg()
Return the number of processes in the system run queue averaged over the last 1, 5, and 15 minutes or raises OSError if the load average was unobtainable. Availability: Unix. | python.library.os#os.getloadavg |
os.getlogin()
Return the name of the user logged in on the controlling terminal of the process. For most purposes, it is more useful to use getpass.getuser() since the latter checks the environment variables LOGNAME or USERNAME to find out who the user is, and falls back to pwd.getpwuid(os.getuid())[0] to get the log... | python.library.os#os.getlogin |
os.getpgid(pid)
Return the process group id of the process with process id pid. If pid is 0, the process group id of the current process is returned. Availability: Unix. | python.library.os#os.getpgid |
os.getpgrp()
Return the id of the current process group. Availability: Unix. | python.library.os#os.getpgrp |
os.getpid()
Return the current process id. | python.library.os#os.getpid |
os.getppid()
Return the parent’s process id. When the parent process has exited, on Unix the id returned is the one of the init process (1), on Windows it is still the same id, which may be already reused by another process. Availability: Unix, Windows. Changed in version 3.2: Added support for Windows. | python.library.os#os.getppid |
os.getpriority(which, who)
Get 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... | python.library.os#os.getpriority |
os.getrandom(size, flags=0)
Get up to size random bytes. The function can return less bytes than requested. These bytes can be used to seed user-space random number generators or for cryptographic purposes. getrandom() relies on entropy gathered from device drivers and other sources of environmental noise. Unnecessar... | python.library.os#os.getrandom |
os.getresgid()
Return a tuple (rgid, egid, sgid) denoting the current process’s real, effective, and saved group ids. Availability: Unix. New in version 3.2. | python.library.os#os.getresgid |
os.getresuid()
Return a tuple (ruid, euid, suid) denoting the current process’s real, effective, and saved user ids. Availability: Unix. New in version 3.2. | python.library.os#os.getresuid |
os.getsid(pid)
Call the system call getsid(). See the Unix manual for the semantics. Availability: Unix. | python.library.os#os.getsid |
os.getuid()
Return the current process’s real user id. Availability: Unix. | python.library.os#os.getuid |
os.getxattr(path, attribute, *, follow_symlinks=True)
Return the value of the extended filesystem attribute attribute for path. attribute can be bytes or str (directly or indirectly through the PathLike interface). If it is str, it is encoded with the filesystem encoding. This function can support specifying a file d... | python.library.os#os.getxattr |
os.get_blocking(fd)
Get the blocking mode of the file descriptor: False if the O_NONBLOCK flag is set, True if the flag is cleared. See also set_blocking() and socket.socket.setblocking(). Availability: Unix. New in version 3.5. | python.library.os#os.get_blocking |
os.get_exec_path(env=None)
Returns the list of directories that will be searched for a named executable, similar to a shell, when launching a process. env, when specified, should be an environment variable dictionary to lookup the PATH in. By default, when env is None, environ is used. New in version 3.2. | python.library.os#os.get_exec_path |
os.get_handle_inheritable(handle)
Get the “inheritable” flag of the specified handle (a boolean). Availability: Windows. | python.library.os#os.get_handle_inheritable |
os.get_inheritable(fd)
Get the “inheritable” flag of the specified file descriptor (a boolean). | python.library.os#os.get_inheritable |
os.get_terminal_size(fd=STDOUT_FILENO)
Return the size of the terminal window as (columns, lines), tuple of type terminal_size. The optional argument fd (default STDOUT_FILENO, or standard output) specifies which file descriptor should be queried. If the file descriptor is not connected to a terminal, an OSError is r... | python.library.os#os.get_terminal_size |
os.GRND_NONBLOCK
By default, when reading from /dev/random, getrandom() blocks if no random bytes are available, and when reading from /dev/urandom, it blocks if the entropy pool has not yet been initialized. If the GRND_NONBLOCK flag is set, then getrandom() does not block in these cases, but instead immediately rai... | python.library.os#os.GRND_NONBLOCK |
os.GRND_RANDOM
If this bit is set, then random bytes are drawn from the /dev/random pool instead of the /dev/urandom pool. New in version 3.6. | python.library.os#os.GRND_RANDOM |
os.initgroups(username, gid)
Call the system initgroups() to initialize the group access list with all of the groups of which the specified username is a member, plus the specified group id. Availability: Unix. New in version 3.2. | python.library.os#os.initgroups |
os.isatty(fd)
Return True if the file descriptor fd is open and connected to a tty(-like) device, else False. | python.library.os#os.isatty |
os.kill(pid, sig)
Send signal sig to the process pid. Constants for the specific signals available on the host platform are defined in the signal module. Windows: The signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT signals are special signals which can only be sent to console processes which share a common console wi... | python.library.os#os.kill |
os.killpg(pgid, sig)
Send the signal sig to the process group pgid. Raises an auditing event os.killpg with arguments pgid, sig. Availability: Unix. | python.library.os#os.killpg |
os.lchflags(path, flags)
Set the flags of path to the numeric flags, like chflags(), but do not follow symbolic links. As of Python 3.3, this is equivalent to os.chflags(path, flags, follow_symlinks=False). Raises an auditing event os.chflags with arguments path, flags. Availability: Unix. Changed in version 3.6: Ac... | python.library.os#os.lchflags |
os.lchmod(path, mode)
Change the mode of path to the numeric mode. If path is a symlink, this affects the symlink rather than the target. See the docs for chmod() for possible values of mode. As of Python 3.3, this is equivalent to os.chmod(path, mode, follow_symlinks=False). Raises an auditing event os.chmod with ar... | python.library.os#os.lchmod |
os.lchown(path, uid, gid)
Change the owner and group id of path to the numeric uid and gid. This function will not follow symbolic links. As of Python 3.3, this is equivalent to os.chown(path, uid, gid, follow_symlinks=False). Raises an auditing event os.chown with arguments path, uid, gid, dir_fd. Availability: Unix... | python.library.os#os.lchown |
os.linesep
The string used to separate (or, rather, terminate) lines on the current platform. This may be a single character, such as '\n' for POSIX, or multiple characters, for example, '\r\n' for Windows. Do not use os.linesep as a line terminator when writing files opened in text mode (the default); use a single '... | python.library.os#os.linesep |
os.link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
Create a hard link pointing to src named dst. This function can support specifying src_dir_fd and/or dst_dir_fd to supply paths relative to directory descriptors, and not following symlinks. Raises an auditing event os.link with arguments sr... | python.library.os#os.link |
os.listdir(path='.')
Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order, and does not include the special entries '.' and '..' even if they are present in the directory. If a file is removed from or added to the directory during the call of this function, ... | python.library.os#os.listdir |
os.listxattr(path=None, *, follow_symlinks=True)
Return a list of the extended filesystem attributes on path. The attributes in the list are represented as strings decoded with the filesystem encoding. If path is None, listxattr() will examine the current directory. This function can support specifying a file descrip... | python.library.os#os.listxattr |
os.lockf(fd, cmd, len)
Apply, test or remove a POSIX lock on an open file descriptor. fd is an open file descriptor. cmd specifies the command to use - one of F_LOCK, F_TLOCK, F_ULOCK or F_TEST. len specifies the section of the file to lock. Raises an auditing event os.lockf with arguments fd, cmd, len. Availability:... | python.library.os#os.lockf |
os.lseek(fd, pos, how)
Set the current position of file descriptor fd to position pos, modified by how: SEEK_SET or 0 to set the position relative to the beginning of the file; SEEK_CUR or 1 to set it relative to the current position; SEEK_END or 2 to set it relative to the end of the file. Return the new cursor posi... | python.library.os#os.lseek |
os.lstat(path, *, dir_fd=None)
Perform the equivalent of an lstat() system call on the given path. Similar to stat(), but does not follow symbolic links. Return a stat_result object. On platforms that do not support symbolic links, this is an alias for stat(). As of Python 3.3, this is equivalent to os.stat(path, dir... | python.library.os#os.lstat |
os.major(device)
Extract the device major number from a raw device number (usually the st_dev or st_rdev field from stat). | python.library.os#os.major |
os.makedev(major, minor)
Compose a raw device number from the major and minor device numbers. | python.library.os#os.makedev |
os.makedirs(name, mode=0o777, exist_ok=False)
Recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory. The mode parameter is passed to mkdir() for creating the leaf directory; see the mkdir() description for how it is interpreted. To set t... | python.library.os#os.makedirs |
os.memfd_create(name[, flags=os.MFD_CLOEXEC])
Create an anonymous file and return a file descriptor that refers to it. flags must be one of the os.MFD_* constants available on the system (or a bitwise ORed combination of them). By default, the new file descriptor is non-inheritable. The name supplied in name is used ... | python.library.os#os.memfd_create |
os.MFD_CLOEXEC
os.MFD_ALLOW_SEALING
os.MFD_HUGETLB
os.MFD_HUGE_SHIFT
os.MFD_HUGE_MASK
os.MFD_HUGE_64KB
os.MFD_HUGE_512KB
os.MFD_HUGE_1MB
os.MFD_HUGE_2MB
os.MFD_HUGE_8MB
os.MFD_HUGE_16MB
os.MFD_HUGE_32MB
os.MFD_HUGE_256MB
os.MFD_HUGE_512MB
os.MFD_HUGE_1GB
os.MFD_HUGE_2GB
os.MFD_HUGE_16GB ... | python.library.os#os.MFD_ALLOW_SEALING |
os.MFD_CLOEXEC
os.MFD_ALLOW_SEALING
os.MFD_HUGETLB
os.MFD_HUGE_SHIFT
os.MFD_HUGE_MASK
os.MFD_HUGE_64KB
os.MFD_HUGE_512KB
os.MFD_HUGE_1MB
os.MFD_HUGE_2MB
os.MFD_HUGE_8MB
os.MFD_HUGE_16MB
os.MFD_HUGE_32MB
os.MFD_HUGE_256MB
os.MFD_HUGE_512MB
os.MFD_HUGE_1GB
os.MFD_HUGE_2GB
os.MFD_HUGE_16GB ... | python.library.os#os.MFD_CLOEXEC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.