Skip to main content

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

Project description

This package on the Python Package Index Tests

stdout_stderr_capturing

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

Maybe better alternatives:

Capture stdout:

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

print(output[0])

is equivalent to

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

Capture stderr:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stdout_stderr_capturing-0.2.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stdout_stderr_capturing-0.2.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file stdout_stderr_capturing-0.2.1.tar.gz.

File metadata

  • Download URL: stdout_stderr_capturing-0.2.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure

File hashes

Hashes for stdout_stderr_capturing-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bd220cb95464b6270c78b9e6126cd2c7eba2eb0e3874df43a27e32513be67f5d
MD5 e662b74f871def6fc2036b03732458f5
BLAKE2b-256 11433667093c708d765ec818213f01fdb0bb01934295a904678e093a190e127e

See more details on using hashes here.

File details

Details for the file stdout_stderr_capturing-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for stdout_stderr_capturing-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c01ce47f1328de157dd197a70331011ee93b4a57330211100f013e67c4f82240
MD5 fda4e88288c51fe973efac3377e7e77f
BLAKE2b-256 419c035ac9e6cfcbc7197c92ee8402f60e830b42488661828e946608b3e6bb6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page