title: How to fix FileNotFoundError: [WinError 2] The system cannot find the file specified with AudioSegment.from_mp3()
body: <p>I've been trying to find the position of spaces of audio silence in the audio of a video, but I can't get past just importing an audio file with pydub in python 3</p>
  
  <p>I've already tried changing the directory that pydub is checking for ffmpeg to one within the project, and the file is in the directory I'm running the script from but it still seems to return the same error. </p>
  
  <pre class="lang-py prettyprint-override"><code>from moviepy import editor
  from pydub import silence, AudioSegment
  from pathlib import Path
  import os
  AudioSegment.converter = r"C:\\Users\\ratee\\PycharmProjects\\untitled\\ffmpeg\\bin\\ffmpeg.exe"
  vid = editor.VideoFileClip("video.mp4")
  print(AudioSegment.ffmpeg)
  my_file = Path("audio.mp3")
  if not my_file.is_file():
      vid.audio.write_audiofile("audio.mp3")
  audio = AudioSegment.from_mp3("audio.mp3")
  print(audio)
  </code></pre>
  
  <p>I expect it to store the mp3 audio segment into the variable <code>audi</code> but it returns:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\pydevd.py", line 1741, in &lt;module&gt;
      main()
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\pydevd.py", line 1735, in main
      globals = debugger.run(setup['file'], None, None, is_module)
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\pydevd.py", line 1135, in run
      pydev_imports.execfile(file, globals, locals)  # execute the script
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
      exec(compile(contents+"\n", file, 'exec'), glob, loc)
    File "C:/Users/ratee/PycharmProjects/untitled/fuc.py", line 12, in &lt;module&gt;
      song = AudioSegment.from_mp3("audio.mp3")
    File "C:\Users\ratee\PycharmProjects\untitled\venv\lib\site-packages\pydub\audio_segment.py", line 716, in from_mp3
      return cls.from_file(file, 'mp3', parameters=parameters)
    File "C:\Users\ratee\PycharmProjects\untitled\venv\lib\site-packages\pydub\audio_segment.py", line 665, in from_file
      info = mediainfo_json(orig_file)
    File "C:\Users\ratee\PycharmProjects\untitled\venv\lib\site-packages\pydub\utils.py", line 263, in mediainfo_json
      res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
    File "C:\Users\ratee\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 756, in __init__
      restore_signals, start_new_session)
    File "C:\Users\ratee\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1155, in _execute_child
      startupinfo)
    File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_monkey.py", line 452, in new_CreateProcess
      return getattr(_subprocess, original_name)(app_name, patch_arg_str_win(cmd_line), *args)
  FileNotFoundError: [WinError 2] The system cannot find the file specified
  </code></pre>
  
  <pre><code>print(AudioSegment.ffmpeg)
  </code></pre>
  
  <p>returns as expected</p>
  
  <blockquote>
    <p>C:\Users\ratee\PycharmProjects\untitled\ffmpeg\bin\ffmpeg.exe</p>
  </blockquote>
  
  <pre><code>print(my_file) returns
  </code></pre>
  
  <p>returns as expected</p>
  
  <blockquote>
    <p>audio.mp3</p>
  </blockquote>
  
  <p>and the code stops running at the point where I try to import audio</p>
  
  <blockquote>
    <p>audio = AudioSegment.from_mp3("audio.mp3")</p>
  </blockquote>