Skip to content

Crash: missing import in datasets/utils.py #409

@mmjamm

Description

@mmjamm

It seems one of the URLs for the built-in SOFA files has gone bad and reveals a bug in the code.

from pyroomacoustics.directivities import MeasuredDirectivityFile

if __name__=='__main__':

    hrtf = MeasuredDirectivityFile(
        path="mit_kemar_normal_pinna.sofa",  # SOFA file is in the database
        fs=24000,
        interp_order=12,
        interp_n_points=1000
    )
    print(hrtf)

When I run the above code, I'm getting the following error:

File "/home/build/.local/share/virtualenvs/pra_dir_test-S0HkAUoS/lib/python3.11/site-packages/pyroomacoustics/datasets/utils.py", line 132, in download_multiple
    except URLError:
           ^^^^^^^^
NameError: name 'URLError' is not defined. Did you mean: 'EOFError'?

This can be fixed by adding from urllib.error import URLError to the beginning of the file.

My guess is that this hasn't been visible before, and now one of the links (https://fedora.kug.ac.at/fedora/objects/o:68229/methods/bdef:Container/get?param0=LSPs_HATS_GuitarCabinets_Akustikmessplatz.sofa) has gone stale and shows the bug.

Python version used: 3.11.8
pyroomacoustics version: 0.8.4
Venv dependencies: pyroomacoustics, numpy, python-sofa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions