档案未找到,但它在那里

发布于 2025-02-08 10:27:16 字数 1421 浏览 1 评论 0原文

因此,我试图打开各种Wav档案,并尝试使用较少的代码行,因为如果我可以将一个周期用于所有循环,我实际上懒了写同样的东西。

num_experimento = 3
vocals = ["a","e","i","o","u"]

trabajos = "{letter}-int{number}.wav"

for vocal in vocals:
    for n in range (1, num_experimento+1):
        archive = trabajos.format(letter=vocal, number=n) #http://blog.espol.edu.ec/telg1001/audio-en-formato-wav/
        sound = wavfile.read(archive)
        print(sound)

问题是它说它找不到档案,

FileNotFoundError                         Traceback (most recent call last)
Input In [18], in <cell line: 7>()
      8 for n in range (1, num_experimento+1):
      9     archive = trabajos.format(letter=vocal, number=n) #http://blog.espol.edu.ec/telg1001/audio-en-formato-wav/
---> 10     sound = wavfile.read(archive)
     11     print(sound)

File c:\programdata\miniconda3\lib\site-packages\scipy\io\wavfile.py:647, in read(filename, mmap)
    645     mmap = False
    646 else:
--> 647     fid = open(filename, 'rb')
    649 try:
    650     file_size, is_big_endian = _read_riff_chunk(fid)

FileNotFoundError: [Errno 2] No such file or directory: 'a-int1.wav'

我将留下环境和文件的图像,也许我是盲目的,但是我在我当前的文件中看到了相同的存档名称在职的。 我在做什么错? 我当前正在处理的文件的图像,代码和文件

i> i' m用西班牙语工作,这就是为什么该名称在我在此处发布的图像和代码之间发生变化的原因,但这是相同的

So I'm trying to open various wav archives and trying to use less line of code because I'm actually lazy to write the same thing 5 time if I could use one cycle for everything.

num_experimento = 3
vocals = ["a","e","i","o","u"]

trabajos = "{letter}-int{number}.wav"

for vocal in vocals:
    for n in range (1, num_experimento+1):
        archive = trabajos.format(letter=vocal, number=n) #http://blog.espol.edu.ec/telg1001/audio-en-formato-wav/
        sound = wavfile.read(archive)
        print(sound)

The thing is that it says it can't find the archive

FileNotFoundError                         Traceback (most recent call last)
Input In [18], in <cell line: 7>()
      8 for n in range (1, num_experimento+1):
      9     archive = trabajos.format(letter=vocal, number=n) #http://blog.espol.edu.ec/telg1001/audio-en-formato-wav/
---> 10     sound = wavfile.read(archive)
     11     print(sound)

File c:\programdata\miniconda3\lib\site-packages\scipy\io\wavfile.py:647, in read(filename, mmap)
    645     mmap = False
    646 else:
--> 647     fid = open(filename, 'rb')
    649 try:
    650     file_size, is_big_endian = _read_riff_chunk(fid)

FileNotFoundError: [Errno 2] No such file or directory: 'a-int1.wav'

I'll leave an image of the environment and the files I'm working, and maybe I'm blind but I see the same archive name in the file I'm currently working.
What am I doing wrong?
An image of the file I'm currently working on, with the code and the files

I'm working in spanish, that's why of the name changes between the image and the code I posted here,but it's the same

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文