【发布时间】:2021-06-10 08:32:56
【问题描述】:
我正在尝试通过音频挑战解决 recaptha,但有一个问题。我可以下载音频并将 wav 文件转换为带有 Speech_recognition 的文本,但我无法将 mp3 文件转换为 wav 文件。 我总是收到这个错误。
File "C:\Pycharm\PycharmProjects\üst\deneme.py", line 9, in <module>
sound = AudioSegment.from_mp3(input_file)
File "C:\Python39\lib\site-packages\pydub\audio_segment.py", line 796, in from_mp3
return cls.from_file(file, 'mp3', parameters=parameters)
File "C:\Python39\lib\site-packages\pydub\audio_segment.py", line 728, in from_file
info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
File "C:\Python39\lib\site-packages\pydub\utils.py", line 274, in mediainfo_json
res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
File "C:\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
我试试这个:
print(os.path.exists('C:\Pycharm\PycharmProjects\sss.mp3')) # myauido file
and result is True. I mean this file exists and I can run this file with
os.system('sss.mp3')
问题是我如何解决这个文件存在但找不到它的问题。
sound = AudioSegment.from_mp3('sss.mp3')
如果我不能解决这个问题,还有其他方法吗?
【问题讨论】:
-
我猜你当前运行脚本的工作目录不是 C:\Pycharm\PycharmProjects\
标签: python html web web-scraping recaptcha