python - 修复 subprocess.py 文件错误 : File not found?

标签 python

我正在使用 Gray Arrow's Dejavu 中的 python 包。我已经安装了运行代码所需的所有依赖项和其他包。运行以下代码时:

    import warnings
    import json
    warnings.filterwarnings("ignore")

    from dejavu import Dejavu
    from dejavu.recognize import FileRecognizer

    with open('dejavu.cnf') as f:
        config = json.load(f)

    djv = Dejavu(config)

    djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')

    song = djv.recognize(FileRecognizer, 'mp3/Sean-Fournier--Falling-For- 
    You.mp3')

    print("from file recognized: {}\n".format(song))

我收到以下错误:

    Traceback (most recent call last):
      File "testing.py", line 13, in <module>
        djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')

      File "D:\dejavu-master\dejavu\__init__.py", line 109, in 
    fingerprint_file song_name=song_name

      File "D:\dejavu-master\dejavu\__init__.py", line 182, in 
    _fingerprint_worker channels, Fs, file_hash = decoder.read(filename, 
    limit)

      File "D:\dejavu-master\dejavu\decoder.py", line 51, in read
        audiofile = AudioSegment.from_file(filename)

      File "C:\Program Files\Python37\lib\site- 
    packages\pydub\audio_segment.py", line 665, in from_file info = 
    mediainfo_json(orig_file)

      File "C:\Program Files\Python37\lib\site-packages\pydub\utils.py", 
    line 263, in mediainfo_json res = Popen(command, 
    stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)

      File "C:\Program Files\Python37\lib\subprocess.py", line 775, in 
    __init__ restore_signals, start_new_session)

      File "C:\Program Files\Python37\lib\subprocess.py", line 1178, in 
    _execute_child startupinfo)

    FileNotFoundError: [WinError 2] The system cannot find the file 
    specified

我已经完全重新安装了 python 3.7 以及所有软件包和依赖项,以尝试解决此问题。

我不明白找不到什么文件,并进行了研究,希望找到这个问题的答案。我衷心感谢您就该主题与我分享的任何帮助和知识。

最佳答案

尝试将“Sean-Fournier--Falling-For-You.mp3”文件放置在您的脚本所在的确切目录中,我认为对 mp3 文件夹的文件夹引用未正确处理:)

djv.fingerprint_file('mp3/Sean-Fournier--Falling-For-You.mp3')

song = djv.recognize(FileRecognizer, 'mp3/Sean-Fournier--Falling-For- 
You.mp3')

关于python - 修复 subprocess.py 文件错误 : File not found?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55599847/

相关文章:

python - Django休息框架: ModelSerializer as field in a ModelSerializer doesn't show choices

python - Azure ML PipelineData 与 DataTransferStep 会生成 0 字节文件

python - OSX 上的 Pyaudio 类型错误

python - Pandas:获取 N 个最大值并在没有元素时插入 NaN 值

python - Python OpenCV中ARGB、RGBA色彩空间的区别

python - 如何在 Windows 上安装 OpenCV 并在不使用包管理器的情况下为 PyCharm 启用它

python - 整数和复数对象的大小之间有什么关系?

python - 使用 for 循环将字母连接到字符串

python - 调用 apiclient.discovery.build 时 URL 的 SSL 证书无效和/或丢失

python - 使用 python 从列中获取数据,而不使用 pyexcel 或其他库