Metadata-Version: 2.1
Name: stdout-stderr-capturing
Version: 0.2.0
Summary: Capture the stdout or stderr output as a list in a context manager block (with).
Home-page: https://github.com/Josef-Friedrich/stdout_stderr_capturing
License: MIT
Author: Josef Friedrich
Author-email: josef@friedrich.rocks
Requires-Python: >=3.8,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.8
Project-URL: Repository, https://github.com/Josef-Friedrich/stdout_stderr_capturing
Description-Content-Type: text/x-rst

stdout_stderr_capturing
=======================

Capture the stdout or stderr output as a list in a context manager block (with).

Maybe better alternatives:

* `capturer <https://pypi.org/project/capturer>`_ https://github.com/xolox/python-capturer
* `stdio-mgr <https://pypi.org/project/stdio-mgr>`_
* `OutputCatcher <https://pypi.org/project/OutputCatcher>`_
* `wurlitzer <https://pypi.org/project/wurlitzer>`_

Capture stdout:

.. code:: python

    with Capturing() as output:
        print('line 1')

    print(output[0])

is equivalent to

.. code:: python

    with Capturing(stream='stdout') as output:
        print('line 1')

Capture stderr:

.. code:: python

    with Capturing(stream='stderr') as output:
        print('line 1', file=sys.stderr)

