Reputation: 45
from scipy.io import wavfile
train_audio_path = 'E:/'
filename = 'file_example_WAV_1MG'
sample_rate, samples = wavfile.read(train_audio_path + filename)
print('sample rate : {}, samples.shape : {}'.format(sample_rate, samples.shape))
FileNotFoundError Traceback (most recent call last)
<ipython-input-27-cd74bbc41446> in <module>
3 train_audio_path = 'E:/'
4 filename = 'file_example_WAV_1MG'
----> 5 sample_rate, samples = wavfile.read(train_audio_path + filename)
6 print('sample rate : {}, samples.shape : {}'.format(sample_rate, samples.shape))
E:\anaconda\lib\site-packages\scipy\io\wavfile.py in read(filename, mmap)
262 mmap = False
263 else:
--> 264 fid = open(filename, 'rb')
265
266 try:
FileNotFoundError: [Errno 2] No such file or directory: 'E:/file_example_WAV_1MG'
I have a problem with my code. I tried to do everything but failed. I have no idea why this error is made. I changed path to everywhere from c to e but still not working at all. what's wrong in my code?
Upvotes: 1
Views: 8807
Reputation: 405
Try
train_audio_path = 'E:\' OR 'E:\\'
change the direction of '\'
And don't forget to add the extension of your image file as well (i.e., jpg,png or any other). I also get this error multiple times in windows.Hope it helps.
Upvotes: 2
Reputation: 1293
I think you are missing the extension. Perhaps file_example_WAV_1MG.wav
?
Check it on your computer.
Upvotes: 0