Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.7k stars 3.74k forks source link

ffmpeg/avconv was not found in your PATH environment variable #1072

Closed AaronHaNasi closed 6 years ago

AaronHaNasi commented 6 years ago

I keep getting the error " ffmpeg/avconv was not found in your PATH environment variable", when I try to use the create_ffmpeg_player or the create_ytdl_player functions.

I've looked through the previous issues and googled around, and nothing has been able to solve my problem.

I also am pretty sure that ffmpeg is installed correctly and a part of my system PATH because I can execute it from the command prompt.

Any ideas?

modelmat commented 6 years ago

If this is rewrite - http://discordpy.readthedocs.io/en/rewrite/migrating.html#voice-changes If this is async, please post your full code and error traceback.

Helehelehele commented 6 years ago

Did you restart your command prompt after adding ffmpeg into your PATH?

AaronHaNasi commented 6 years ago

I think its async, but I'm kinda green so I'll just post the code and see what you lads think:

@bot.command(pass_context = True)
async def play(ctx, search_query : str):
    player = await vc.create_ytdl_player('https://www.youtube.com/watch?v=rUWaBDvyhqU')
    player.start()
[youtube] rUWaBDvyhqU: Downloading webpage
[youtube] rUWaBDvyhqU: Downloading video info webpage
[youtube] rUWaBDvyhqU: Extracting video information
Ignoring exception in command play
Traceback (most recent call last):
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\voice_client.py", line 431, in create_ffmpeg_player
    p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr)
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\Aaron-PC\OneDrive\Visual Studio\Homunculus\Homunculus\Homunculus.py", line 125, in play
    player = await vc.create_ytdl_player('https://www.youtube.com/watch?v=rUWaBDvyhqU')
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\voice_client.py", line 541, in create_ytdl_player
    player = self.create_ffmpeg_player(download_url, **kwargs)
  File "C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\voice_client.py", line 434, in create_ffmpeg_player
    raise ClientException('ffmpeg/avconv was not found in your PATH environment variable') from e
discord.errors.ClientException: ffmpeg/avconv was not found in your PATH environment variable

Also tried getting some help on a discord bot developer server, we tried some stuff. I asked if I could screenshot the conversation to show you what else I've tried: https://imgur.com/a/5tFfP

Did you restart your command prompt after adding ffmpeg into your PATH?

Also I did restart the command prompt after adding ffmpeg. I can open ffmpeg no problem with command prompt. Python just doesn't seem to want to open it for some reason from what I can tell.

leovoel commented 6 years ago

did you restart your computer? sometimes people need to do it on windows

AaronHaNasi commented 6 years ago

Yes, twice actually.

modelmat commented 6 years ago

What is the result of echo %PATH%

AaronHaNasi commented 6 years ago
C:\ffmpeg\bin;C:\ffmpeg-20180211-4961ddf-win64-static\bin;C:\Program Files\Microsoft MPI\Bin\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\;C:\Users\Aaron-PC\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\DLLs;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Lib;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Lib\site-packages;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\;C:\Users\Aaron-PC\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\DLLs;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Lib;C:\Users\Aaron-PC\AppData\Local\Programs\Python\Python36-32\Lib\site-packages;
modelmat commented 6 years ago

https://github.com/coursera-dl/edx-dl/issues/405

modelmat commented 6 years ago

also could we please move to the discord.py supprot server https://discord.gg/r3sSKJJ

AaronHaNasi commented 6 years ago

So for future people who show up:

The nice gentlemen helped me in their discord server.

I was debugging from visual studio, which caused some weird issues.

If you try running the python script directly from the command prompt, then it works perfectly.

pastorhudson commented 6 years ago

You probably need avconv. If it won't let you install using sudo apt-get install libav-tools You can download the .deb from here:

wget http://launchpadlibrarian.net/339874908/libav-tools_3.3.4-2_all.deb

Then run sudo apt install ./libav-tools_3.3.4.2_all.deb

wellingtonsilverio commented 4 years ago

or install 'sudo apt-get install ffmpeg' in linux/debian