Last active
June 23, 2023 02:17
-
-
Save simonLeary42/d11de6997a7f857466e9cb4ba7caef22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# print to stderr. If stderr is a TTY, print in red | |
def print_err(*args, **kwargs): | |
if sys.stderr.isatty(): | |
print('\033[1;31m', end='', file=sys.stderr) | |
print(*args, **kwargs, file=sys.stderr) | |
if sys.stderr.isatty(): | |
print('\033[0m', end='', file=sys.stderr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment