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

TypeError: expected str, bytes or os.PathLike object, not SpooledTemporaryFile #74

Closed
Shivamagrawal2014 opened this issue Sep 24, 2018 · 1 comment

Comments

@Shivamagrawal2014
Copy link

Hi,
I am trying to load my byte data that is in binary format into audioread.audio_open, ideally I should directly give path for the audio file but I am trying to decode the mp3 after loading my audio file into tensorflow and there arises the issue.

Complete Trace Back is as Follows:
`TypeError Traceback (most recent call last)
in ()
----> 1 au = aio(buffer)

c:\users\shivam.agarwal\pycharmprojects\audioapi\venv\lib\site-packages\audioread_init_.py in audio_open(path)
78 from . import rawread
79 try:
---> 80 return rawread.RawAudioFile(path)
81 except DecodeError:
82 pass

c:\users\shivam.agarwal\pycharmprojects\audioapi\venv\lib\site-packages\audioread\rawread.py in init(self, filename)
59 """
60 def init(self, filename):
---> 61 self._fh = open(filename, 'rb')
62
63 try:
`

I tried to load the bytes as file-like object from SpooledTemporaryFile but this open in 'rb' format keeps giving the issue.

How should I load the bytes as file-like object ?

@sampsyo
Copy link
Member

sampsyo commented Sep 24, 2018

Hello! That's not currently possible; the library needs to read a file from the filesystem. You could write the data to a temporary file, for example.

See also #37, an in-progress effort to support decoding audio data directly.

@sampsyo sampsyo closed this as completed Sep 24, 2018
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