Python scripting
library & tools¶
python subprocess library¶
basic usage
-
.run():
-
.popen(): thesubprocessis managed bypopenclass structure
class subprocess.Popen(args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None,
close_fds=True, shell=False, cwd=None, env=None, universal_newlines=None, startupinfo=None, creationflags=0,
restore_signals=True, start_new_session=False, pass_fds=(), *, group=None, extra_groups=None, user=None,
umask=-1, encoding=None, errors=None, text=None, pipesize=-1, process_group=None)
### usage
Popen(["/usr/bin/git", "commit", "-m", "Fixes a bug."])
.communicate()
return (stdout_data, stderr_data)
Popen.communicate(input = None, timeout = None)
### usage
proc = subprocess.Popen(...)
try:
outs, errs = proc.communicate(timeout=15)
except TimeoutExpired:
proc.kill()
outs, errs = proc.communicate()
PBD¶
a tool to add breakpoint and execute code
b: set a breakpointc: continue debugging until you hit a breakpoints: step through the coden: to go to next line of codel: list source code for the current file (default: 11 lines including the line being executed)u: navigate up a stack framed: navigate down a stack framep: to print the value of an expression in the current context
To set breakpoint in code, simply adding breakpoint() will do the work for you