简体   繁体   English

errno 2:没有此类文件或目录

[英]errno 2: No such file or directory

I've seen multiple threads with this issue but I can't find one that applies to my situation. 我已经看到多个线程与此问题有关,但找不到适合我情况的线程。 I'm using a library called audiodiff that essentially tells you whether or not two audio files have the same content. 我正在使用一个名为audiodiff的库,该库从本质上告诉您两个音频文件是否具有相同的内容。 I have recorded 2 .wav files previously saved that I want to check. 我已经记录了2个.wav文件,以前保存过要检查的文件。 Here is the code: 这是代码:

import audiodiff
print audiodiff.audio_equal('output1.wav', 'output2.wav', ffmpeg_bin=None)

Here is the output I'm getting in the terminal when I run it: 这是我运行终端时得到的输出:

File "/usr/local/lib/python2.7/dist-packages/audiodiff/__init__.py", line 51, in audio_equal
return checksum(name1, ffmpeg_bin) == checksum(name2, ffmpeg_bin)
File "/usr/local/lib/python2.7/dist-packages/audiodiff/__init__.py", line 86, in checksum
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception

The explanations I've seen on here have something to do with the cd, but all of my files are in the same folder. 我在这里看到的解释与cd有关,但是我所有的文件都在同一个文件夹中。 So, I'm not sure how that applies. 因此,我不确定该如何应用。 Any insight on this would be awesome. 任何对此的见识都会很棒。 TIA. TIA。

You can make absolute paths to the files using Python's os.path tools: 您可以使用Python的os.path工具建立文件的绝对路径:

 import os

 fname = os.path.join(path_to_output1, 'output1.wav')

If you need to grab the path at the start of the application, before you do any change directory you can do it: 如果您需要在应用程序的开头获取路径,那么在执行任何更改目录之前,您可以执行以下操作:

path = os.getcwd()  # Get the current path where the application was started

Without knowing your full source code, directory layout and exact program invocation it is difficult to say more. 不知道完整的源代码,目录布局和确切的程序调用,很难说更多。

More info: 更多信息:

https://docs.python.org/3.4/library/os.path.html?highlight=path#module-os.path https://docs.python.org/3.4/library/os.path.html?highlight=path#module-os.path

Did you check the dependencies for audiodiff? 您是否检查了audiodiff的依赖项?

audiodiff requires FFmpeg to be installed in your system. audiodiff需要在系统中安装FFmpeg。 The path is ffmpeg by default, but you can change it by following ways (later rules take precedence over earlier ones). 默认情况下,该路径为ffmpeg,但您可以通过以下方式进行更改(较新的规则优先于较早的规则)。

  1. audiodiff.FFMPEG_BIN module property audiodiff.FFMPEG_BIN模块属性
  2. FFMPEG_BIN environment variable FFMPEG_BIN环境变量
  3. ffmpeg_bin flag (commandline tool only) ffmpeg_bin标志(仅命令行工具)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM