vocalpy / crowsetta

A tool to work with any format for annotating vocalizations
https://crowsetta.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
49 stars 3 forks source link

Add example annotation files #180

Closed NickleDave closed 2 years ago

NickleDave commented 2 years ago
NickleDave commented 2 years ago

importlib.resources.path works only on 3.10 but says it was deprecated in 3.11 :frowning_face:

I think I need to do https://docs.python.org/3.11/library/importlib.resources.html#importlib.resources.as_file which will require re-writing everything with context managers unfortunately. But this is a constraint of getting a "path" to something that's inside a .zip

See example here: https://importlib-resources.readthedocs.io/en/latest/using.html#file-system-or-zip-file

from importlib_resources import files, as_file

source = files(email.tests.data).joinpath('message.eml')
with as_file(source) as eml:
    third_party_api_requiring_file_system_path(eml)

Hoping I can do the as_file(source) part inside the get function and then return that context manager for someone to use?