rerun
rerun copied to clipboard
Python text logging: make sure rerun warnings are always written to stderr
Unless in strict mode, the Python Rerun SDK ignore errors and prints warnings when used the wrong way (instead of throwing exceptions). It is therefore very important that this warnings are visible to users.
Our warning function is _send_warning and it calls logging.warning, but unless the user has enabled logging, this won't be visible. I think this is bad.
Potential solutions:
- Always print warnings to
stderr - Check if
loggingis hooked up. If not, log tostderrinstead.
One workaround (for developers) to set the environment variable PYTHONWARNINGS="always" or even PYTHONWARNINGS="error", which causes an exception to be raised in case of a warning being logged.