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

paths from FilePathsBase error in LibSndFile #315

Closed
jkrumbiegel opened this issue Mar 15, 2021 · 3 comments
Closed

paths from FilePathsBase error in LibSndFile #315

jkrumbiegel opened this issue Mar 15, 2021 · 3 comments

Comments

@jkrumbiegel
Copy link
Contributor

The question is whether this is a LibSndFile issue, a FilePathsBase issue, or a FileIO issue.

I'm trying to save WAV files via FileTrees.jl, which uses paths from FilePathsBase internally. These seem to be forwarded by FileIO to LibSndFile which doesn't work, because its underlying load/save functions don't recognize this path type. I'm wondering if FileIO should normalize the path to String before passing it on.

Here's the relevant part of the error:

Errors encountered while load FileIO.File{FileIO.DataFormat{:WAV}, FilePathsBase.WindowsPath}(p"[removed].wav").
All errors:
===========================================
ArgumentError: Package WAV [8149f6b0-98f6-5db9-b78f-408fbbb8ef88] is required but does not seem to be installed:      
 - Run `Pkg.instantiate()` to install all recorded dependencies.

===========================================
LibSndFile load error: neither load nor fileio_load is defined
  due to MethodError(LibSndFile.sf_open, (p"[removed].wav", 16, LibSndFile.SF_INFO(0, 0, 0, 0, 0, 0)), 0x00000000000073f0)
  Will try next loader.

===========================================

Fatal error:
ERROR: ArgumentError: Package WAV [8149f6b0-98f6-5db9-b78f-408fbbb8ef88] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
  [1] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:986
  [2] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:910
  [3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:198
  [4] action
    @ ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:192 [inlined]
  [5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::FilePathsBase.WindowsPath; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:181
  [6] action
    @ ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:181 [inlined]
  [7] load(::FilePathsBase.WindowsPath; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:113
  [8] load(::FilePathsBase.WindowsPath)
    @ FileIO ~\.julia\packages\FileIO\BUPwf\src\loadsave.jl:110
@timholy
Copy link
Member

timholy commented Mar 16, 2021

I think normalizing to a string would break @rofinn's usage---I thought the point of #259 was to make sure the module got the "filename" as passed by the caller---but I'm not sure. If so, it must have been broken long before the FileIO 1.6 mess.

I'm also noting that the error messages aren't ideal. Perhaps fixed in #317?

@rofinn
Copy link
Contributor

rofinn commented Jun 3, 2021

Yeah, the path shouldn't need to be normalized. I don't see how this is an issue with filepaths specifically :/ AFAICT, you just don't have the dependency installed to load it...? Maybe a more complete example would help?

@johnnychen94
Copy link
Member

johnnychen94 commented Jun 3, 2021

This is because LibSndFile does not support FilePaths yet.

LibSndFile load error: neither load nor fileio_load is defined
  due to MethodError(LibSndFile.sf_open, (p"[removed].wav", 16, LibSndFile.SF_INFO(0, 0, 0, 0, 0, 0)), 0x00000000000073f0)
  Will try next loader.

Yeah, the path shouldn't need to be normalized.

So it's decided to be a LibSndFile issue I guess. And can be probably fixed by loosing the type constrain in https://github.com/JuliaAudio/LibSndFile.jl/blob/a644a1725994d7ab47848428582b15920a8151ef/src/sourcesink.jl#L2-L8

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

4 participants