doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
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.spawnvp
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.spawnvpe
os.startfile(path[, operation]) Start a file with its associated application. When operation is not specified or 'open', this acts like double-clicking the file in Windows Explorer, or giving the file name as an argument to the start command from the interactive command shell: the file is opened with whatever applica...
python.library.os#os.startfile
os.stat(path, *, dir_fd=None, follow_symlinks=True) Get the status of a file or a file descriptor. Perform the equivalent of a stat() system call on the given path. path may be specified as either a string or bytes – directly or indirectly through the PathLike interface – or as an open file descriptor. Return a stat_...
python.library.os#os.stat
os.statvfs(path) Perform a statvfs() system call on the given path. The return value is an object whose attributes describe the filesystem on the given path, and correspond to the members of the statvfs structure, namely: f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files, f_ffree, f_favail, f_flag, f_namemax, f...
python.library.os#os.statvfs
class os.stat_result Object whose attributes correspond roughly to the members of the stat structure. It is used for the result of os.stat(), os.fstat() and os.lstat(). Attributes: st_mode File mode: file type and file mode bits (permissions). st_ino Platform dependent, but if non-zero, uniquely identifies ...
python.library.os#os.stat_result
st_atime Time of most recent access expressed in seconds.
python.library.os#os.stat_result.st_atime
st_atime_ns Time of most recent access expressed in nanoseconds as an integer.
python.library.os#os.stat_result.st_atime_ns
st_birthtime Time of file creation.
python.library.os#os.stat_result.st_birthtime
st_blksize “Preferred” blocksize for efficient file system I/O. Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.
python.library.os#os.stat_result.st_blksize
st_blocks Number of 512-byte blocks allocated for file. This may be smaller than st_size/512 when the file has holes.
python.library.os#os.stat_result.st_blocks
st_creator Creator of the file.
python.library.os#os.stat_result.st_creator
st_ctime Platform dependent: the time of most recent metadata change on Unix, the time of creation on Windows, expressed in seconds.
python.library.os#os.stat_result.st_ctime
st_ctime_ns Platform dependent: the time of most recent metadata change on Unix, the time of creation on Windows, expressed in nanoseconds as an integer.
python.library.os#os.stat_result.st_ctime_ns
st_dev Identifier of the device on which this file resides.
python.library.os#os.stat_result.st_dev
st_file_attributes Windows file attributes: dwFileAttributes member of the BY_HANDLE_FILE_INFORMATION structure returned by GetFileInformationByHandle(). See the FILE_ATTRIBUTE_* constants in the stat module.
python.library.os#os.stat_result.st_file_attributes
st_flags User defined flags for file.
python.library.os#os.stat_result.st_flags
st_fstype String that uniquely identifies the type of the filesystem that contains the file.
python.library.os#os.stat_result.st_fstype
st_gen File generation number.
python.library.os#os.stat_result.st_gen
st_gid Group identifier of the file owner.
python.library.os#os.stat_result.st_gid
st_ino Platform dependent, but if non-zero, uniquely identifies the file for a given value of st_dev. Typically: the inode number on Unix, the file index on Windows
python.library.os#os.stat_result.st_ino
st_mode File mode: file type and file mode bits (permissions).
python.library.os#os.stat_result.st_mode
st_mtime Time of most recent content modification expressed in seconds.
python.library.os#os.stat_result.st_mtime
st_mtime_ns Time of most recent content modification expressed in nanoseconds as an integer.
python.library.os#os.stat_result.st_mtime_ns
st_nlink Number of hard links.
python.library.os#os.stat_result.st_nlink
st_rdev Type of device if an inode device.
python.library.os#os.stat_result.st_rdev
st_reparse_tag When st_file_attributes has the FILE_ATTRIBUTE_REPARSE_POINT set, this field contains the tag identifying the type of reparse point. See the IO_REPARSE_TAG_* constants in the stat module.
python.library.os#os.stat_result.st_reparse_tag
st_rsize Real size of the file.
python.library.os#os.stat_result.st_rsize
st_size Size of the file in bytes, if it is a regular file or a symbolic link. The size of a symbolic link is the length of the pathname it contains, without a terminating null byte.
python.library.os#os.stat_result.st_size
st_type File type.
python.library.os#os.stat_result.st_type
st_uid User identifier of the file owner.
python.library.os#os.stat_result.st_uid
os.strerror(code) Return the error message corresponding to the error code in code. On platforms where strerror() returns NULL when given an unknown error number, ValueError is raised.
python.library.os#os.strerror
os.supports_bytes_environ True if the native OS type of the environment is bytes (eg. False on Windows). New in version 3.2.
python.library.os#os.supports_bytes_environ
os.supports_dir_fd A set object indicating which functions in the os module accept an open file descriptor for their dir_fd parameter. Different platforms provide different features, and the underlying functionality Python uses to implement the dir_fd parameter is not available on all platforms Python supports. For c...
python.library.os#os.supports_dir_fd
os.supports_effective_ids A set object indicating whether os.access() permits specifying True for its effective_ids parameter on the local platform. (Specifying False for effective_ids is always supported on all platforms.) If the local platform supports it, the collection will contain os.access(); otherwise it will ...
python.library.os#os.supports_effective_ids
os.supports_fd A set object indicating which functions in the os module permit specifying their path parameter as an open file descriptor on the local platform. Different platforms provide different features, and the underlying functionality Python uses to accept open file descriptors as path arguments is not availab...
python.library.os#os.supports_fd
os.supports_follow_symlinks A set object indicating which functions in the os module accept False for their follow_symlinks parameter on the local platform. Different platforms provide different features, and the underlying functionality Python uses to implement follow_symlinks is not available on all platforms Pytho...
python.library.os#os.supports_follow_symlinks
os.symlink(src, dst, target_is_directory=False, *, dir_fd=None) Create a symbolic link pointing to src named dst. On Windows, a symlink represents either a file or a directory, and does not morph to the target dynamically. If the target is present, the type of the symlink will be created to match. Otherwise, the syml...
python.library.os#os.symlink
os.sync() Force write of everything to disk. Availability: Unix. New in version 3.3.
python.library.os#os.sync
os.sysconf(name) Return integer-valued system configuration values. If the configuration value specified by name isn’t defined, -1 is returned. The comments regarding the name parameter for confstr() apply here as well; the dictionary that provides information on the known names is given by sysconf_names. Availabilit...
python.library.os#os.sysconf
os.sysconf_names Dictionary mapping names accepted by sysconf() to the integer values defined for those names by the host operating system. This can be used to determine the set of names known to the system. Availability: Unix.
python.library.os#os.sysconf_names
os.system(command) Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to sys.stdin, etc. are not reflected in the environment of the executed command. If command generates any output, it will be sent to the interpreter s...
python.library.os#os.system
os.tcgetpgrp(fd) Return the process group associated with the terminal given by fd (an open file descriptor as returned by os.open()). Availability: Unix.
python.library.os#os.tcgetpgrp
os.tcsetpgrp(fd, pg) Set the process group associated with the terminal given by fd (an open file descriptor as returned by os.open()) to pg. Availability: Unix.
python.library.os#os.tcsetpgrp
class os.terminal_size A subclass of tuple, holding (columns, lines) of the terminal window size. columns Width of the terminal window in characters. lines Height of the terminal window in characters.
python.library.os#os.terminal_size
columns Width of the terminal window in characters.
python.library.os#os.terminal_size.columns
lines Height of the terminal window in characters.
python.library.os#os.terminal_size.lines
os.times() Returns the current global process times. The return value is an object with five attributes: user - user time system - system time children_user - user time of all child processes children_system - system time of all child processes elapsed - elapsed real time since a fixed point in the past For ba...
python.library.os#os.times
os.truncate(path, length) Truncate the file corresponding to path, so that it is at most length bytes in size. This function can support specifying a file descriptor. Raises an auditing event os.truncate with arguments path, length. Availability: Unix, Windows. New in version 3.3. Changed in version 3.5: Added sup...
python.library.os#os.truncate
os.ttyname(fd) Return a string which specifies the terminal device associated with file descriptor fd. If fd is not associated with a terminal device, an exception is raised. Availability: Unix.
python.library.os#os.ttyname
os.umask(mask) Set the current numeric umask and return the previous umask.
python.library.os#os.umask
os.uname() Returns information identifying the current operating system. The return value is an object with five attributes: sysname - operating system name nodename - name of machine on network (implementation-defined) release - operating system release version - operating system version machine - hardware ide...
python.library.os#os.uname
os.unlink(path, *, dir_fd=None) Remove (delete) the file path. This function is semantically identical to remove(); the unlink name is its traditional Unix name. Please see the documentation for remove() for further information. Raises an auditing event os.remove with arguments path, dir_fd. New in version 3.3: The ...
python.library.os#os.unlink
os.unsetenv(key) Unset (delete) the environment variable named key. Such changes to the environment affect subprocesses started with os.system(), popen() or fork() and execv(). Deletion of items in os.environ is automatically translated into a corresponding call to unsetenv(); however, calls to unsetenv() don’t updat...
python.library.os#os.unsetenv
os.urandom(size) Return a string of size random bytes suitable for cryptographic use. This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. On Linux, if the g...
python.library.os#os.urandom
os.utime(path, times=None, *, [ns, ]dir_fd=None, follow_symlinks=True) Set the access and modified times of the file specified by path. utime() takes two optional parameters, times and ns. These specify the times set on path and are used as follows: If ns is specified, it must be a 2-tuple of the form (atime_ns, mti...
python.library.os#os.utime
os.wait() Wait for completion of a child process, and return a tuple containing its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file wa...
python.library.os#os.wait
os.wait3(options) Similar to waitpid(), except no process id argument is given and a 3-element tuple containing the child’s process id, exit status indication, and resource usage information is returned. Refer to resource.getrusage() for details on resource usage information. The option argument is the same as that p...
python.library.os#os.wait3
os.wait4(pid, options) Similar to waitpid(), except a 3-element tuple, containing the child’s process id, exit status indication, and resource usage information is returned. Refer to resource.getrusage() for details on resource usage information. The arguments to wait4() are the same as those provided to waitpid(). w...
python.library.os#os.wait4
os.waitid(idtype, id, options) Wait for the completion of one or more child processes. idtype can be P_PID, P_PGID, P_ALL, or P_PIDFD on Linux. id specifies the pid to wait on. options is constructed from the ORing of one or more of WEXITED, WSTOPPED or WCONTINUED and additionally may be ORed with WNOHANG or WNOWAIT....
python.library.os#os.waitid
os.waitpid(pid, options) The details of this function differ on Unix and Windows. On Unix: Wait for completion of a child process given by process id pid, and return a tuple containing its process id and exit status indication (encoded as for wait()). The semantics of the call are affected by the value of the integer...
python.library.os#os.waitpid
os.waitstatus_to_exitcode(status) Convert a wait status to an exit code. On Unix: If the process exited normally (if WIFEXITED(status) is true), return the process exit status (return WEXITSTATUS(status)): result greater than or equal to 0. If the process was terminated by a signal (if WIFSIGNALED(status) is true), ...
python.library.os#os.waitstatus_to_exitcode
os.walk(top, topdown=True, onerror=None, followlinks=False) Generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory top (including top itself), it yields a 3-tuple (dirpath, dirnames, filenames). dirpath is a string, the path to ...
python.library.os#os.walk
os.WCONTINUED This option causes child processes to be reported if they have been continued from a job control stop since their status was last reported. Availability: some Unix systems.
python.library.os#os.WCONTINUED
os.WCOREDUMP(status) Return True if a core dump was generated for the process, otherwise return False. This function should be employed only if WIFSIGNALED() is true. Availability: Unix.
python.library.os#os.WCOREDUMP
os.WEXITED os.WSTOPPED os.WNOWAIT Flags that can be used in options in waitid() that specify what child signal to wait for. Availability: Unix. New in version 3.3.
python.library.os#os.WEXITED
os.WEXITSTATUS(status) Return the process exit status. This function should be employed only if WIFEXITED() is true. Availability: Unix.
python.library.os#os.WEXITSTATUS
os.WIFCONTINUED(status) Return True if a stopped child has been resumed by delivery of SIGCONT (if the process has been continued from a job control stop), otherwise return False. See WCONTINUED option. Availability: Unix.
python.library.os#os.WIFCONTINUED
os.WIFEXITED(status) Return True if the process exited terminated normally, that is, by calling exit() or _exit(), or by returning from main(); otherwise return False. Availability: Unix.
python.library.os#os.WIFEXITED
os.WIFSIGNALED(status) Return True if the process was terminated by a signal, otherwise return False. Availability: Unix.
python.library.os#os.WIFSIGNALED
os.WIFSTOPPED(status) Return True if the process was stopped by delivery of a signal, otherwise return False. WIFSTOPPED() only returns True if the waitpid() call was done using WUNTRACED option or when the process is being traced (see ptrace(2)). Availability: Unix.
python.library.os#os.WIFSTOPPED
os.WNOHANG The option for waitpid() to return immediately if no child process status is available immediately. The function returns (0, 0) in this case. Availability: Unix.
python.library.os#os.WNOHANG
os.WEXITED os.WSTOPPED os.WNOWAIT Flags that can be used in options in waitid() that specify what child signal to wait for. Availability: Unix. New in version 3.3.
python.library.os#os.WNOWAIT
os.write(fd, str) Write the bytestring in str to file descriptor fd. Return the number of bytes actually written. 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 write a “file object” returned by the built-in function open() or by popen...
python.library.os#os.write
os.writev(fd, buffers) Write the contents of buffers to file descriptor fd. 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. Returns the total number of bytes actually written. The operati...
python.library.os#os.writev
os.WEXITED os.WSTOPPED os.WNOWAIT Flags that can be used in options in waitid() that specify what child signal to wait for. Availability: Unix. New in version 3.3.
python.library.os#os.WSTOPPED
os.WSTOPSIG(status) Return the signal which caused the process to stop. This function should be employed only if WIFSTOPPED() is true. Availability: Unix.
python.library.os#os.WSTOPSIG
os.WTERMSIG(status) Return the number of the signal that caused the process to terminate. This function should be employed only if WIFSIGNALED() is true. Availability: Unix.
python.library.os#os.WTERMSIG
os.WUNTRACED This option causes child processes to be reported if they have been stopped but their current state has not been reported since they were stopped. Availability: Unix.
python.library.os#os.WUNTRACED
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.W_OK
os.XATTR_CREATE This is a possible value for the flags argument in setxattr(). It indicates the operation must create an attribute.
python.library.os#os.XATTR_CREATE
os.XATTR_REPLACE This is a possible value for the flags argument in setxattr(). It indicates the operation must replace an existing attribute.
python.library.os#os.XATTR_REPLACE
os.XATTR_SIZE_MAX The maximum size the value of an extended attribute can be. Currently, this is 64 KiB on Linux.
python.library.os#os.XATTR_SIZE_MAX
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.X_OK
os._exit(n) Exit the process with status n, without calling cleanup handlers, flushing stdio buffers, etc. Note The standard way to exit is sys.exit(n). _exit() should normally only be used in the child process after a fork().
python.library.os#os._exit
exception OSError([arg]) exception OSError(errno, strerror[, filename[, winerror[, filename2]]]) This exception is raised when a system function returns a system-related error, including I/O failures such as “file not found” or “disk full” (not for illegal argument types or other incidental errors). The second form...
python.library.exceptions#OSError
errno A numeric error code from the C variable errno.
python.library.exceptions#OSError.errno
filename filename2 For exceptions that involve a file system path (such as open() or os.unlink()), filename is the file name passed to the function. For functions that involve two file system paths (such as os.rename()), filename2 corresponds to the second file name passed to the function.
python.library.exceptions#OSError.filename
filename filename2 For exceptions that involve a file system path (such as open() or os.unlink()), filename is the file name passed to the function. For functions that involve two file system paths (such as os.rename()), filename2 corresponds to the second file name passed to the function.
python.library.exceptions#OSError.filename2
strerror The corresponding error message, as provided by the operating system. It is formatted by the C functions perror() under POSIX, and FormatMessage() under Windows.
python.library.exceptions#OSError.strerror
winerror Under Windows, this gives you the native Windows error code. The errno attribute is then an approximate translation, in POSIX terms, of that native error code. Under Windows, if the winerror constructor argument is an integer, the errno attribute is determined from the Windows error code, and the errno argum...
python.library.exceptions#OSError.winerror
ossaudiodev — Access to OSS-compatible audio devices This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and commercial Unices, and is the standard audio interface for Linux and recent versions of FreeBSD. Changed in version 3.3: Operations in ...
python.library.ossaudiodev
ossaudiodev.open(mode) ossaudiodev.open(device, mode) Open an audio device and return an OSS audio device object. This object supports many file-like methods, such as read(), write(), and fileno() (although there are subtle differences between conventional Unix read/write semantics and those of OSS audio devices). ...
python.library.ossaudiodev#ossaudiodev.open
ossaudiodev.openmixer([device]) Open a mixer device and return an OSS mixer device object. device is the mixer device filename to use. If it is not specified, this module first looks in the environment variable MIXERDEV for a device to use. If not found, it falls back to /dev/mixer.
python.library.ossaudiodev#ossaudiodev.openmixer
exception ossaudiodev.OSSAudioError This exception is raised on certain errors. The argument is a string describing what went wrong. (If ossaudiodev receives an error from a system call such as open(), write(), or ioctl(), it raises OSError. Errors detected directly by ossaudiodev result in OSSAudioError.) (For backw...
python.library.ossaudiodev#ossaudiodev.OSSAudioError
oss_audio_device.bufsize() Returns the size of the hardware buffer, in samples.
python.library.ossaudiodev#ossaudiodev.oss_audio_device.bufsize
oss_audio_device.channels(nchannels) Set the number of output channels to nchannels. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. Returns the number of channels the device was set to.
python.library.ossaudiodev#ossaudiodev.oss_audio_device.channels
oss_audio_device.close() Explicitly close the audio device. When you are done writing to or reading from an audio device, you should explicitly close it. A closed device cannot be used again.
python.library.ossaudiodev#ossaudiodev.oss_audio_device.close
oss_audio_device.closed Boolean indicating whether the device has been closed.
python.library.ossaudiodev#ossaudiodev.oss_audio_device.closed
oss_audio_device.fileno() Return the file descriptor associated with the device.
python.library.ossaudiodev#ossaudiodev.oss_audio_device.fileno