Ask coding questions

← Back to all posts
Audio File wont play
lazymunch (0)

I've got multiple comments around line 34. That spot is where I've attempted MULTIPLE methods to get this audio file to play.

The error is the same every time.

Task exception was never retrieved
future: <Task finished name='Task-14' coro=>><VoiceClient._create_socket() done, defined at >/opt/virtualenvs/python3/lib/python3.8/site->packages/discord/voice_client.py:172> exception=gaierror(-2, >'Name or service not known')>
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site->packages/discord/voice_client.py", line 191, in _create_socket
self.endpoint_ip = socket.gethostbyname(self.endpoint)
socket.gaierror: [Errno -2] Name or service not known

Can you play audio?

Comments
hotnewtop
OldWizard209 (1631)

Its all in the Docs.

First import replit and make sure to upload the sound file as .mp3 or .wav . Type this code:

from replit import audio
import time

audio.play_file("download.mp3")
time.sleep(10)

The time.sleep in the end is there because once the file is executed, repl abruptly stops. So it is there so that the audio can run.

I copied this answer from another question i answered

lazymunch (0)

@OldWizard209 I solved it, that wasn't it. Discord.py was the wrong version.