Open leoauri opened 4 months ago
Hi there, in #421 suppressing warnings from underlying libraries is discussed.
In my case I would like to capture the errors, in order to discard mp3s which trigger warnings.
I tried something like:
import librosa import io from contextlib import redirect_stderr f = io.StringIO() with redirect_stderr(f): librosa.load('file.mp3')
But the errors go straight to stderr and are not captured by the context manager. Presumably something going on in a subprocess or something.
Any ideas on picking up libmpg123 warnings?
Presumably, libsndfile is writing straight to STDERR. It seems a bit odd that redirect_stderr doesn't catch that, but perhaps it only operates on the python level?
redirect_stderr
Hi there, in #421 suppressing warnings from underlying libraries is discussed.
In my case I would like to capture the errors, in order to discard mp3s which trigger warnings.
I tried something like:
But the errors go straight to stderr and are not captured by the context manager. Presumably something going on in a subprocess or something.
Any ideas on picking up libmpg123 warnings?