Python FileNotFoundError:[WinError 2]系统在尝试使用pysndfx时找不到指定的文件
我试图用python和pysndfx处理wav文件,但遇到了这个奇怪的错误。我尝试了许多不同的路径格式和许多不同的路径。即使os.path.isfile()返回true,它仍然会出现此错误。任何帮助都将不胜感激Python FileNotFoundError:[WinError 2]系统在尝试使用pysndfx时找不到指定的文件,python,python-3.x,audio,subprocess,filepath,Python,Python 3.x,Audio,Subprocess,Filepath,我试图用python和pysndfx处理wav文件,但遇到了这个奇怪的错误。我尝试了许多不同的路径格式和许多不同的路径。即使os.path.isfile()返回true,它仍然会出现此错误。任何帮助都将不胜感激 from pysndfx import AudioEffectsChain import os in_file = os.getcwd() + "\\" + "a.mp3" in_file = in_file.replace("\\", "//")#tried many things
from pysndfx import AudioEffectsChain
import os
in_file = os.getcwd() + "\\" + "a.mp3"
in_file = in_file.replace("\\", "//")#tried many things here, tried to it without any replacing
if os.path.isfile(in_file):
print("fileyes") #This returns true
else:
print("not a file")
print(in_file)
fs = 44100
fx = (AudioEffectsChain().
reverb().
delay().
phaser()
)
fx(in_file,"apro.mp3")
这是错误
fileyes
E://PyEarTraning//Test//a.mp3
Traceback (most recent call last):
File "e:/PyEarTraning/Test/test.py", line 28, in <module>
fx(in_file,"E:\\PyEarTraning\\Test\\apro.mp3")
File "C:\Program Files (x86)\Python38-32\lib\site-packages\pysndfx\dsp.py", line 368, in __call__
infile = FilePathInput(src)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\pysndfx\sndfiles.py", line 29, in __init__
stdout, stderr = Popen(shlex.split(info_cmd, posix=False),
File "C:\Program Files (x86)\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files (x86)\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
fileyes
E://PyEarTraning//Test//a.mp3
回溯(最近一次呼叫最后一次):
文件“e:/PyEarTraning/Test/Test.py”,第28行,在
fx(在文件“E:\\PyEarTraning\\Test\\apro.mp3”中)
文件“C:\Program Files(x86)\Python38-32\lib\site packages\pysndfx\dsp.py”,第368行,在调用中__
infle=FilePathInput(src)
文件“C:\Program Files(x86)\Python38-32\lib\site packages\pysndfx\sndfiles.py”,第29行,在__
stdout,stderr=Popen(shlex.split(info_cmd,posix=False),
文件“C:\Program Files(x86)\Python38-32\lib\subprocess.py”,第854行,在\uuu init中__
self.\u execute\u child(参数、可执行文件、预执行文件、关闭文件、,
文件“C:\Program Files(x86)\Python38-32\lib\subprocess.py”,第1307行,在\u execute\u child中
hp、ht、pid、tid=\u winapi.CreateProcess(可执行文件、参数、,
FileNotFoundError:[WinError 2]系统找不到指定的文件
我还不能评论,所以我会在这里询问。您的文件是否与python程序位于同一目录(文件夹)中?如果没有,则即使文件确实存在于某个位置,也无法工作。请尝试将您的文件和程序代码复制或移动到新的/同一文件夹中。它位于同一文件夹中,然后尝试使用命名您的文件。(文件类型)因此,如果我试图打开一个txt文件,它将是fgvjdk=open(“file.txt”)