Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoBackendError: please add more details to the exception message #104

Open
slychief opened this issue Feb 4, 2020 · 1 comment
Open

Comments

@slychief
Copy link

slychief commented Feb 4, 2020

Hi,

I just spent 2 hours debugging, why audioread cannot find ffmpeg when everything else can see and access it.

It turned out, I was iterating over a directory and one of the files was not an audio file resulting in the NoBackendError, which is IMHO misleading. Could you please add a descriptive message to the exception? Something like "File xyz has a codec where no backend could be identified for".

Best,
Alex

[2020-02-04 14:58:34,366] ERROR in app: Exception on /upload [GET]
Traceback (most recent call last):
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\anaconda\envs\msd_demo\lib\site-packages\flask\app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "app.py", line 102, in upload
    ap.convert_audio(f["path"])
  File "C:\Work\Github\slychief\speechrec\audio_processing.py", line 48, in convert_audio
    wave_data = load_audio(src_name)
  File "C:\Work\Github\slychief\speechrec\audio_processing.py", line 44, in load_audio
    wave_data, sample_rate = librosa.core.load(f_name, sr=SAMPLE_RATE, mono=True)
  File "C:\anaconda\envs\msd_demo\lib\site-packages\librosa\core\audio.py", line 119, in load
    with audioread.audio_open(os.path.realpath(path)) as input_file:
  File "C:\anaconda\envs\msd_demo\lib\site-packages\audioread\__init__.py", line 116, in audio_open
    raise NoBackendError()
audioread.exceptions.NoBackendError
@sampsyo
Copy link
Member

sampsyo commented Feb 4, 2020

Sure; a wording clarification would be good idea! I'd be happy to accept a pull request that does something like that (as long as it's backwards-compatible).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants