添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
酒量大的大象  ·  both distro provided ...·  1 月前    · 
乐观的酸菜鱼  ·  交易沦陷 ...·  3 月前    · 
奋斗的山楂  ·  opencv-python-headless ...·  5 月前    · 

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 File ".../soundfile.py", line 1263, in _open raise TypeError("Invalid file: {0!r}".format(self.name)) TypeError: Invalid file: PosixPath('...') >>> soundfile. __version__ '0.9.0' >>> librosa. __version__ '0.8.0'

Software versions

python: 3.8.5 (default, Jul 21 2020, 10:48:26)
[Clang 11.0.3 (clang-1103.0.32.62)]

librosa: 0.8.0

audioread: 2.1.8
numpy: 1.18.5
scipy: 1.4.1
sklearn: 0.22.2.post1
joblib: 0.16.0
decorator: 4.4.2
soundfile: 0.9.0
resampy: 0.2.2
numba: 0.50.1

numpydoc: None
sphinx: None
sphinx_rtd_theme: None
sphinxcontrib.versioning: None
sphinx-gallery: None
pytest: 6.0.1
pytest-mpl: None
pytest-cov: None
matplotlib: 3.3.0
presets: None

The problem is that we didn't update the minimum soundfile version necessary for this to work. If you upgrade soundfile to >=0.10.2, Path works as expected.

We should revise the requirements spec accordingly, but there are no code changes necessary to address this.

* bumped minimum soundfile version to 0.10.2 for pathlib support #1236
* clarified file path support in core.load #1267
* rephrase docs for path loading

:O I did pip install -U soundfile before reporting this issue, and pip reported v0.10.2 to be installed, but soundfile.__version__ still gave 0.9.0. Not sure what was going on there. Still, the librosa dependency is still at 0.9.0 so should be updated.

I have the same issue with the discrepancy between pip 0.10.3.post1 and soundfile. version 0.9.0. Did you find out what was causing this issue?

I have the same issue and no fix either.
But one workaround appears to be converting the Path to string. Like
y,sr = librosa.load(str(path))
(like actually mentioned in the original bug report - but in case someone missed it...)