子进程-startupinfo-FileNotFoundError-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

子进程-startupinfo-FileNotFoundError

is大龙 2020-03-24 19:27:16 114

我试图运行此代码

filepath = "C:/Users/Linus/Desktop/Test/Audio/"     #Input audio file path


from pydub import AudioSegment
import os

def mp3_to_wav(audio_file_name):
    if audio_file_name.split('.')[1] == 'mp3':    
        sound = AudioSegment.from_mp3(audio_file_name)
        audio_file_name = audio_file_name.split('.')[0] + '.wav'
        sound.export(audio_file_name, format="wav")

if __name__ == "__main__":
    for audio_file_name in os.listdir(filepath): 
        file_name = filepath + audio_file_name
        file_name = os.path.realpath(file_name)
        mp3_to_wav(file_name)

但我在下面(最后一行)出现此错误

runfile('C:/Users/Linus/Desktop/Test/test2.py', wdir='C:/Users/Linus/Desktop/Test')
C:\Users\Linus\AppData\Roaming\Python\Python37\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
C:\Users\Linus\AppData\Roaming\Python\Python37\site-packages\pydub\utils.py:193: RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
  warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
Traceback (most recent call last):

  File "<ipython-input-1-b871056654c0>", line 1, in <module>
    runfile('C:/Users/Linus/Desktop/Test/test2.py', wdir='C:/Users/Linus/Desktop/Test')

  File "C:\Programme\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Programme\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Linus/Desktop/Test/test2.py", line 22, in <module>
    mp3_to_wav(file_name)

  File "C:/Users/Linus/Desktop/Test/test2.py", line 14, in mp3_to_wav
    sound = AudioSegment.from_mp3(audio_file_name)

  File "C:\Users\Linus\AppData\Roaming\Python\Python37\site-packages\pydub\audio_segment.py", line 716, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)

  File "C:\Users\Linus\AppData\Roaming\Python\Python37\site-packages\pydub\audio_segment.py", line 665, in from_file
    info = mediainfo_json(orig_file)

  File "C:\Users\Linus\AppData\Roaming\Python\Python37\site-packages\pydub\utils.py", line 263, in mediainfo_json
    res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)

  File "C:\Programme\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in __init__
    super(SubprocessPopen, self).__init__(\*rgs, \*kwargs)

  File "C:\Programme\Anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)

  File "C:\Programme\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)

FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden

最后一行是德语,表示“系统找不到指定的文件”。

我在很多论坛上都读了很多书,但找不到任何解决方案。我是Python编程(以及Generell编程)的新手,我不知道该怎么做。如果有人可以帮助,那就太好了。

问题来源:stackoverflow

子进程进程 进程file for进程 error进程 进程star
分享到
取消 提交回答
全部回答(1)
  • is大龙
    2020-03-24 19:27:25

    Ich glaube,Dass Sie FFMPEG nicht installiert haben。Ihrem程序中deinem路径中的Mach malpip install ffmpeg和dann enweder schreiben Sie das:`AudioSegment.ffmpeg =“ C:\ path \ path \ ffmpeg.exe” gerade Deutsch,也对不起wenn ich etwas flasch geschrieben habe :)

    回答来源:stackoverflow

    0 0
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

相似问题
最新问题