doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
Popen.kill() Kills the child. On POSIX OSs the function sends SIGKILL to the child. On Windows kill() is an alias for terminate().
python.library.subprocess#subprocess.Popen.kill
Popen.pid The process ID of the child process. Note that if you set the shell argument to True, this is the process ID of the spawned shell.
python.library.subprocess#subprocess.Popen.pid
Popen.poll() Check if child process has terminated. Set and return returncode attribute. Otherwise, returns None.
python.library.subprocess#subprocess.Popen.poll
Popen.returncode The child return code, set by poll() and wait() (and indirectly by communicate()). A None value indicates that the process hasn’t terminated yet. A negative value -N indicates that the child was terminated by signal N (POSIX only).
python.library.subprocess#subprocess.Popen.returncode
Popen.send_signal(signal) Sends the signal signal to the child. Do nothing if the process completed. Note On Windows, SIGTERM is an alias for terminate(). CTRL_C_EVENT and CTRL_BREAK_EVENT can be sent to processes started with a creationflags parameter which includes CREATE_NEW_PROCESS_GROUP.
python.library.subprocess#subprocess.Popen.send_signal
Popen.stderr If the stderr argument was PIPE, this attribute is a readable stream object as returned by open(). Reading from the stream provides error output from the child process. If the encoding or errors arguments were specified or the universal_newlines argument was True, the stream is a text stream, otherwise i...
python.library.subprocess#subprocess.Popen.stderr
Popen.stdin If the stdin argument was PIPE, this attribute is a writeable stream object as returned by open(). If the encoding or errors arguments were specified or the universal_newlines argument was True, the stream is a text stream, otherwise it is a byte stream. If the stdin argument was not PIPE, this attribute ...
python.library.subprocess#subprocess.Popen.stdin
Popen.stdout If the stdout argument was PIPE, this attribute is a readable stream object as returned by open(). Reading from the stream provides output from the child process. If the encoding or errors arguments were specified or the universal_newlines argument was True, the stream is a text stream, otherwise it is a...
python.library.subprocess#subprocess.Popen.stdout
Popen.terminate() Stop the child. On POSIX OSs the method sends SIGTERM to the child. On Windows the Win32 API function TerminateProcess() is called to stop the child.
python.library.subprocess#subprocess.Popen.terminate
Popen.wait(timeout=None) Wait for child process to terminate. Set and return returncode attribute. If the process does not terminate after timeout seconds, raise a TimeoutExpired exception. It is safe to catch this exception and retry the wait. Note This will deadlock when using stdout=PIPE or stderr=PIPE and the ch...
python.library.subprocess#subprocess.Popen.wait
subprocess.REALTIME_PRIORITY_CLASS A Popen creationflags parameter to specify that a new process will have realtime priority. You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts system threads that manage mouse input, keyboard input, and background disk flushing. This class can be appropriate...
python.library.subprocess#subprocess.REALTIME_PRIORITY_CLASS
subprocess.run(args, *, stdin=None, input=None, stdout=None, stderr=None, capture_output=False, shell=False, cwd=None, timeout=None, check=False, encoding=None, errors=None, text=None, env=None, universal_newlines=None, **other_popen_kwargs) Run the command described by args. Wait for command to complete, then return...
python.library.subprocess#subprocess.run
subprocess.STARTF_USESHOWWINDOW Specifies that the STARTUPINFO.wShowWindow attribute contains additional information.
python.library.subprocess#subprocess.STARTF_USESHOWWINDOW
subprocess.STARTF_USESTDHANDLES Specifies that the STARTUPINFO.hStdInput, STARTUPINFO.hStdOutput, and STARTUPINFO.hStdError attributes contain additional information.
python.library.subprocess#subprocess.STARTF_USESTDHANDLES
class subprocess.STARTUPINFO(*, dwFlags=0, hStdInput=None, hStdOutput=None, hStdError=None, wShowWindow=0, lpAttributeList=None) Partial support of the Windows STARTUPINFO structure is used for Popen creation. The following attributes can be set by passing them as keyword-only arguments. Changed in version 3.7: Keyw...
python.library.subprocess#subprocess.STARTUPINFO
dwFlags A bit field that determines whether certain STARTUPINFO attributes are used when the process creates a window. si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW
python.library.subprocess#subprocess.STARTUPINFO.dwFlags
hStdError If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window’s buffer.
python.library.subprocess#subprocess.STARTUPINFO.hStdError
hStdInput If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard input handle for the process. If STARTF_USESTDHANDLES is not specified, the default for standard input is the keyboard buffer.
python.library.subprocess#subprocess.STARTUPINFO.hStdInput
hStdOutput If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard output handle for the process. Otherwise, this attribute is ignored and the default for standard output is the console window’s buffer.
python.library.subprocess#subprocess.STARTUPINFO.hStdOutput
lpAttributeList A dictionary of additional attributes for process creation as given in STARTUPINFOEX, see UpdateProcThreadAttribute. Supported attributes: handle_list Sequence of handles that will be inherited. close_fds must be true if non-empty. The handles must be temporarily made inheritable by os.set_handle_in...
python.library.subprocess#subprocess.STARTUPINFO.lpAttributeList
wShowWindow If dwFlags specifies STARTF_USESHOWWINDOW, this attribute can be any of the values that can be specified in the nCmdShow parameter for the ShowWindow function, except for SW_SHOWDEFAULT. Otherwise, this attribute is ignored. SW_HIDE is provided for this attribute. It is used when Popen is called with shel...
python.library.subprocess#subprocess.STARTUPINFO.wShowWindow
subprocess.STDOUT Special value that can be used as the stderr argument to Popen and indicates that standard error should go into the same handle as standard output.
python.library.subprocess#subprocess.STDOUT
subprocess.STD_ERROR_HANDLE The standard error device. Initially, this is the active console screen buffer, CONOUT$.
python.library.subprocess#subprocess.STD_ERROR_HANDLE
subprocess.STD_INPUT_HANDLE The standard input device. Initially, this is the console input buffer, CONIN$.
python.library.subprocess#subprocess.STD_INPUT_HANDLE
subprocess.STD_OUTPUT_HANDLE The standard output device. Initially, this is the active console screen buffer, CONOUT$.
python.library.subprocess#subprocess.STD_OUTPUT_HANDLE
exception subprocess.SubprocessError Base class for all other exceptions from this module. New in version 3.3.
python.library.subprocess#subprocess.SubprocessError
subprocess.SW_HIDE Hides the window. Another window will be activated.
python.library.subprocess#subprocess.SW_HIDE
exception subprocess.TimeoutExpired Subclass of SubprocessError, raised when a timeout expires while waiting for a child process. cmd Command that was used to spawn the child process. timeout Timeout in seconds. output Output of the child process if it was captured by run() or check_output(). Otherwis...
python.library.subprocess#subprocess.TimeoutExpired
cmd Command that was used to spawn the child process.
python.library.subprocess#subprocess.TimeoutExpired.cmd
output Output of the child process if it was captured by run() or check_output(). Otherwise, None.
python.library.subprocess#subprocess.TimeoutExpired.output
stderr Stderr output of the child process if it was captured by run(). Otherwise, None.
python.library.subprocess#subprocess.TimeoutExpired.stderr
stdout Alias for output, for symmetry with stderr.
python.library.subprocess#subprocess.TimeoutExpired.stdout
timeout Timeout in seconds.
python.library.subprocess#subprocess.TimeoutExpired.timeout
Subprocesses Source code: Lib/asyncio/subprocess.py, Lib/asyncio/base_subprocess.py This section describes high-level async/await asyncio APIs to create and manage subprocesses. Here’s an example of how asyncio can run a shell command and obtain its result: import asyncio async def run(cmd): proc = await asyncio.c...
python.library.asyncio-subprocess
sum(iterable, /, start=0) Sums start and the items of an iterable from left to right and returns the total. The iterable’s items are normally numbers, and the start value is not allowed to be a string. For some use cases, there are good alternatives to sum(). The preferred, fast way to concatenate a sequence of strin...
python.library.functions#sum
super([type[, object-or-type]]) Return a proxy object that delegates method calls to a parent or sibling class of type. This is useful for accessing inherited methods that have been overridden in a class. The object-or-type determines the method resolution order to be searched. The search starts from the class right ...
python.library.functions#super
symbol — Constants used with Python parse trees Source code: Lib/symbol.py This module provides constants which represent the numeric values of internal nodes of the parse tree. Unlike most Python constants, these use lower-case names. Refer to the file Grammar/Grammar in the Python distribution for the definitions of ...
python.library.symbol
symbol.sym_name Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated.
python.library.symbol#symbol.sym_name
symtable — Access to the compiler’s symbol tables Source code: Lib/symtable.py Symbol tables are generated by the compiler from AST just before bytecode is generated. The symbol table is responsible for calculating the scope of every identifier in the code. symtable provides an interface to examine these tables. Genera...
python.library.symtable
class symtable.Class A namespace of a class. This class inherits SymbolTable. get_methods() Return a tuple containing the names of methods declared in the class.
python.library.symtable#symtable.Class
get_methods() Return a tuple containing the names of methods declared in the class.
python.library.symtable#symtable.Class.get_methods
class symtable.Function A namespace for a function or method. This class inherits SymbolTable. get_parameters() Return a tuple containing names of parameters to this function. get_locals() Return a tuple containing names of locals in this function. get_globals() Return a tuple containing names of glob...
python.library.symtable#symtable.Function
get_frees() Return a tuple containing names of free variables in this function.
python.library.symtable#symtable.Function.get_frees
get_globals() Return a tuple containing names of globals in this function.
python.library.symtable#symtable.Function.get_globals
get_locals() Return a tuple containing names of locals in this function.
python.library.symtable#symtable.Function.get_locals
get_nonlocals() Return a tuple containing names of nonlocals in this function.
python.library.symtable#symtable.Function.get_nonlocals
get_parameters() Return a tuple containing names of parameters to this function.
python.library.symtable#symtable.Function.get_parameters
class symtable.Symbol An entry in a SymbolTable corresponding to an identifier in the source. The constructor is not public. get_name() Return the symbol’s name. is_referenced() Return True if the symbol is used in its block. is_imported() Return True if the symbol is created from an import statement....
python.library.symtable#symtable.Symbol
get_name() Return the symbol’s name.
python.library.symtable#symtable.Symbol.get_name
get_namespace() Return the namespace bound to this name. If more than one namespace is bound, ValueError is raised.
python.library.symtable#symtable.Symbol.get_namespace
get_namespaces() Return a list of namespaces bound to this name.
python.library.symtable#symtable.Symbol.get_namespaces
is_annotated() Return True if the symbol is annotated. New in version 3.6.
python.library.symtable#symtable.Symbol.is_annotated
is_assigned() Return True if the symbol is assigned to in its block.
python.library.symtable#symtable.Symbol.is_assigned
is_declared_global() Return True if the symbol is declared global with a global statement.
python.library.symtable#symtable.Symbol.is_declared_global
is_free() Return True if the symbol is referenced in its block, but not assigned to.
python.library.symtable#symtable.Symbol.is_free
is_global() Return True if the symbol is global.
python.library.symtable#symtable.Symbol.is_global
is_imported() Return True if the symbol is created from an import statement.
python.library.symtable#symtable.Symbol.is_imported
is_local() Return True if the symbol is local to its block.
python.library.symtable#symtable.Symbol.is_local
is_namespace() Return True if name binding introduces new namespace. If the name is used as the target of a function or class statement, this will be true. For example: >>> table = symtable.symtable("def some_func(): pass", "string", "exec") >>> table.lookup("some_func").is_namespace() True Note that a single name c...
python.library.symtable#symtable.Symbol.is_namespace
is_nonlocal() Return True if the symbol is nonlocal.
python.library.symtable#symtable.Symbol.is_nonlocal
is_parameter() Return True if the symbol is a parameter.
python.library.symtable#symtable.Symbol.is_parameter
is_referenced() Return True if the symbol is used in its block.
python.library.symtable#symtable.Symbol.is_referenced
class symtable.SymbolTable A namespace table for a block. The constructor is not public. get_type() Return the type of the symbol table. Possible values are 'class', 'module', and 'function'. get_id() Return the table’s identifier. get_name() Return the table’s name. This is the name of the class if t...
python.library.symtable#symtable.SymbolTable
get_children() Return a list of the nested symbol tables.
python.library.symtable#symtable.SymbolTable.get_children
get_id() Return the table’s identifier.
python.library.symtable#symtable.SymbolTable.get_id
get_identifiers() Return a list of names of symbols in this table.
python.library.symtable#symtable.SymbolTable.get_identifiers
get_lineno() Return the number of the first line in the block this table represents.
python.library.symtable#symtable.SymbolTable.get_lineno
get_name() Return the table’s name. This is the name of the class if the table is for a class, the name of the function if the table is for a function, or 'top' if the table is global (get_type() returns 'module').
python.library.symtable#symtable.SymbolTable.get_name
get_symbols() Return a list of Symbol instances for names in the table.
python.library.symtable#symtable.SymbolTable.get_symbols
get_type() Return the type of the symbol table. Possible values are 'class', 'module', and 'function'.
python.library.symtable#symtable.SymbolTable.get_type
has_children() Return True if the block has nested namespaces within it. These can be obtained with get_children().
python.library.symtable#symtable.SymbolTable.has_children
is_nested() Return True if the block is a nested class or function.
python.library.symtable#symtable.SymbolTable.is_nested
is_optimized() Return True if the locals in this table can be optimized.
python.library.symtable#symtable.SymbolTable.is_optimized
lookup(name) Lookup name in the table and return a Symbol instance.
python.library.symtable#symtable.SymbolTable.lookup
symtable.symtable(code, filename, compile_type) Return the toplevel SymbolTable for the Python source code. filename is the name of the file containing the code. compile_type is like the mode argument to compile().
python.library.symtable#symtable.symtable
exception SyntaxError Raised when the parser encounters a syntax error. This may occur in an import statement, in a call to the built-in functions exec() or eval(), or when reading the initial script or standard input (also interactively). The str() of the exception instance returns only the error message. filename...
python.library.exceptions#SyntaxError
filename The name of the file the syntax error occurred in.
python.library.exceptions#SyntaxError.filename
lineno Which line number in the file the error occurred in. This is 1-indexed: the first line in the file has a lineno of 1.
python.library.exceptions#SyntaxError.lineno
offset The column in the line where the error occurred. This is 1-indexed: the first character in the line has an offset of 1.
python.library.exceptions#SyntaxError.offset
text The source code text involved in the error.
python.library.exceptions#SyntaxError.text
exception SyntaxWarning Base class for warnings about dubious syntax.
python.library.exceptions#SyntaxWarning
sys — System-specific parameters and functions This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. sys.abiflags On POSIX systems where Python was built with the standard configure script, this conta...
python.library.sys
sys.abiflags On POSIX systems where Python was built with the standard configure script, this contains the ABI flags as specified by PEP 3149. Changed in version 3.8: Default flags became an empty string (m flag for pymalloc has been removed). New in version 3.2.
python.library.sys#sys.abiflags
sys.addaudithook(hook) Append the callable hook to the list of active auditing hooks for the current (sub)interpreter. When an auditing event is raised through the sys.audit() function, each hook will be called in the order it was added with the event name and the tuple of arguments. Native hooks added by PySys_AddAu...
python.library.sys#sys.addaudithook
sys.api_version The C API version for this interpreter. Programmers may find this useful when debugging version conflicts between Python and extension modules.
python.library.sys#sys.api_version
sys.argv The list of command line arguments passed to a Python script. argv[0] is the script name (it is operating system dependent whether this is a full pathname or not). If the command was executed using the -c command line option to the interpreter, argv[0] is set to the string '-c'. If no script name was passed ...
python.library.sys#sys.argv
sys.audit(event, *args) Raise an auditing event and trigger any active auditing hooks. event is a string identifying the event, and args may contain optional arguments with more information about the event. The number and types of arguments for a given event are considered a public and stable API and should not be mo...
python.library.sys#sys.audit
sys.base_exec_prefix Set during Python startup, before site.py is run, to the same value as exec_prefix. If not running in a virtual environment, the values will stay the same; if site.py finds that a virtual environment is in use, the values of prefix and exec_prefix will be changed to point to the virtual environme...
python.library.sys#sys.base_exec_prefix
sys.base_prefix Set during Python startup, before site.py is run, to the same value as prefix. If not running in a virtual environment, the values will stay the same; if site.py finds that a virtual environment is in use, the values of prefix and exec_prefix will be changed to point to the virtual environment, wherea...
python.library.sys#sys.base_prefix
sys.breakpointhook() This hook function is called by built-in breakpoint(). By default, it drops you into the pdb debugger, but it can be set to any other function so that you can choose which debugger gets used. The signature of this function is dependent on what it calls. For example, the default binding (e.g. pdb....
python.library.sys#sys.breakpointhook
sys.builtin_module_names A tuple of strings giving the names of all modules that are compiled into this Python interpreter. (This information is not available in any other way — modules.keys() only lists the imported modules.)
python.library.sys#sys.builtin_module_names
sys.byteorder An indicator of the native byte order. This will have the value 'big' on big-endian (most-significant byte first) platforms, and 'little' on little-endian (least-significant byte first) platforms.
python.library.sys#sys.byteorder
sys.call_tracing(func, args) Call func(*args), while tracing is enabled. The tracing state is saved, and restored afterwards. This is intended to be called from a debugger from a checkpoint, to recursively debug some other code.
python.library.sys#sys.call_tracing
sys.copyright A string containing the copyright pertaining to the Python interpreter.
python.library.sys#sys.copyright
sys.displayhook(value) If value is not None, this function prints repr(value) to sys.stdout, and saves value in builtins._. If repr(value) is not encodable to sys.stdout.encoding with sys.stdout.errors error handler (which is probably 'strict'), encode it to sys.stdout.encoding with 'backslashreplace' error handler. ...
python.library.sys#sys.displayhook
sys.dllhandle Integer specifying the handle of the Python DLL. Availability: Windows.
python.library.sys#sys.dllhandle
sys.dont_write_bytecode If this is true, Python won’t try to write .pyc files on the import of source modules. This value is initially set to True or False depending on the -B command line option and the PYTHONDONTWRITEBYTECODE environment variable, but you can set it yourself to control bytecode file generation.
python.library.sys#sys.dont_write_bytecode
sys.excepthook(type, value, traceback) This function prints out a given traceback and exception to sys.stderr. When an exception is raised and uncaught, the interpreter calls sys.excepthook with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens ju...
python.library.sys#sys.excepthook
sys.exc_info() This function returns a tuple of three values that give information about the exception that is currently being handled. The information returned is specific both to the current thread and to the current stack frame. If the current stack frame is not handling an exception, the information is taken from...
python.library.sys#sys.exc_info
sys.executable A string giving the absolute path of the executable binary for the Python interpreter, on systems where this makes sense. If Python is unable to retrieve the real path to its executable, sys.executable will be an empty string or None.
python.library.sys#sys.executable