Ошибка при использовании метода pydub's AudioSegment.from_mp3 - PullRequest
0 голосов
/ 03 октября 2018

Код ниже - это операторы импорта в первой ячейке.Я использую Python 3 в Jupyter Notebook, если это имеет значение

import sys
!python -m pip install --upgrade pip
!pip install --prefix {sys.prefix} pydub
from pydub import AudioSegment
from pydub.utils import db_to_float
AudioSegment.ffmpeg = "Users\Bill\Anaconda3\pkgs\imageio-2.3.0-py36_0\Lib\site-packages\imageio\plugins\ffmeg.py" #this is the edit referred to in the comments

В следующей ячейке это единственная строка кода, которую я имею, поэтому она вызывается сразу после импорта.

clip = AudioSegment.from_mp3("song1.mp3")

Я получаю следующую ошибку

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-5-4844ec04b652> in <module>()
----> 1 clip = AudioSegment.from_mp3("song1.mp3")

~\Documents\Fall 2018\Data Vis\Untitled Folder\pydub\audio_segment.py in from_mp3(cls, file, parameters)
    714     @classmethod
    715     def from_mp3(cls, file, parameters=None):
--> 716         return cls.from_file(file, 'mp3', parameters)
    717 
    718     @classmethod

~\Documents\Fall 2018\Data Vis\Untitled Folder\pydub\audio_segment.py in from_file(cls, file, format, codec, parameters, **kwargs)
    663             stdin_data = file.read()
    664 
--> 665         info = mediainfo_json(orig_file)
    666         if info:
    667             audio_streams = [x for x in info['streams']

~\Documents\Fall 2018\Data Vis\Untitled Folder\pydub\utils.py in mediainfo_json(filepath)
    261 
    262     command = [prober, '-of', 'json'] + command_args
--> 263     res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
    264     output, stderr = res.communicate(input=stdin_data)
    265     output = output.decode("utf-8", 'ignore')

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
    707                                 c2pread, c2pwrite,
    708                                 errread, errwrite,
--> 709                                 restore_signals, start_new_session)
    710         except:
    711             # Cleanup if the child failed starting.

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
    995                                          env,
    996                                          os.fspath(cwd) if cwd is not None else None,
--> 997                                          startupinfo)
    998             finally:
    999                 # Child is launched. Close the parent's copy of those pipe

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

Я проверил двойную и тройную проверку, и введенное мной имя файла является правильным, как имя (song1), так и тип (mp3).Заранее спасибо!

...