redirecting streams within Python scripts
Project description
pytee2
pytee2 is a package providing functionalities of redirecting stdout and stderr to a string and an output file. The key feature of pytee2 is that it can redirect stdout and stderr from C binding invocations.
Table of Contents
Installation
pip install pytee2
Usage
from pytee2 import Tee
tee = Tee(output_filepath='output.txt')
tee.start()
# do many things...
tee.stop()
Now the stdout and stderr have been saved to output.txt, and you can get the string version of the output by
capturedtext = tee.get_capturedtext()
Known issues
pytee2 cannot work properly on Windows. This issue should be fixed in the future.
License
pytee2 is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytee2-0.0.1.tar.gz.
File metadata
- Download URL: pytee2-0.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.26.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e84a845dec8b42232400f6089cf6b487802503796933fe09f81d6e5b878f476e
|
|
| MD5 |
429bb718578a896f2ecf2428353d0e8b
|
|
| BLAKE2b-256 |
62b065c937c0e81c9aef8e6bfdf07b7b3ad4d6a81aef8a3df44836c84b9ad305
|
File details
Details for the file pytee2-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pytee2-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.26.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1f36fb62331ccd3e8c4a6fc0ef65b1f9ba3561364406e3eb0f640617b18f14b
|
|
| MD5 |
a35e50a9e4fd9762802ba9b573b39d28
|
|
| BLAKE2b-256 |
9599e454734ce3f5a10894d49448653887abfab6828c820fc294a52fba3f9ab9
|