py Documentation - Read the Docs
py Documentation - Read the Docs
py Documentation - Read the Docs
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>py</strong> <strong>Documentation</strong>, Release 1.4.27.dev1<br />
4.2 <strong>py</strong>.io object reference<br />
class <strong>py</strong>.io.StdCaptureFD(out=True, err=True, mixed=False, in_=True, patchsys=True, now=True)<br />
This class allows to capture writes to FD1 and FD2 and may connect a NULL file to FD0 (and prevent reads<br />
from sys.stdin). If any of <strong>the</strong> 0,1,2 file descriptors is invalid it will not be captured.<br />
resume()<br />
resume capturing with original temp files.<br />
done(save=True)<br />
return (outfile, errfile) and stop capturing.<br />
readouterr()<br />
return snapshot value of stdout/stderr capturings.<br />
classmethod call(func, *args, **kwargs)<br />
return a (res, out, err) tuple where out and err represent <strong>the</strong> output/error output during function execution.<br />
call <strong>the</strong> given function with args/kwargs and capture output/error during its execution.<br />
reset()<br />
reset sys.stdout/stderr and return captured output as strings.<br />
suspend()<br />
return current snapshot captures, memorize tempfiles.<br />
class <strong>py</strong>.io.StdCapture(out=True, err=True, in_=True, mixed=False, now=True)<br />
This class allows to capture writes to sys.stdout|stderr “in-memory” and will raise errors on tries to read from<br />
sys.stdin. It only modifies sys.stdout|stderr|stdin attributes and does not touch underlying File Descriptors (use<br />
StdCaptureFD for that).<br />
done(save=True)<br />
return (outfile, errfile) and stop capturing.<br />
resume()<br />
resume capturing with original temp files.<br />
readouterr()<br />
return snapshot value of stdout/stderr capturings.<br />
classmethod call(func, *args, **kwargs)<br />
return a (res, out, err) tuple where out and err represent <strong>the</strong> output/error output during function execution.<br />
call <strong>the</strong> given function with args/kwargs and capture output/error during its execution.<br />
reset()<br />
reset sys.stdout/stderr and return captured output as strings.<br />
suspend()<br />
return current snapshot captures, memorize tempfiles.<br />
class <strong>py</strong>.io.TerminalWriter(file=None, stringio=False, encoding=None)<br />
26 Chapter 4. <strong>py</strong>.io