Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: await VoiceClient.disconnect() raise OSError: [WinError 10038] when passing a str that represent a non file-like object #9039

Closed
3 tasks done
Snipy7374 opened this issue Nov 2, 2022 · 0 comments · Fixed by #9525
Labels
unconfirmed bug A bug report that needs triaging

Comments

@Snipy7374
Copy link

Snipy7374 commented Nov 2, 2022

Summary

When using a FFmpegPCMAudio audio source with a source that represent a non file-like object (e.g a url) and when disconnecting from a VoiceChannel you get an OSError. This bug was found while trying to test more

Reproduction Steps

Connect to a VoiceChannel
Start playing something using FFmpegPCMAudio as audio source with a source that does't represent a file-like object
Disconnect from the VoiceChannel using await VoiceClient.disconnect()

Minimal Reproducible Code

@bot.command()
async def lmao(ctx):
    channel: discord.VoiceChannel = await bot.fetch_channel(874005538285977603)
    vc = await channel.connect()
    vc.play(discord.FFmpegPCMAudio("https://github.com/ninjamuffin99/Funkin/blob/a083938ac803a91fbb15f03e432dea620f8a3b4a/assets/songs/bopeebo/Inst.mp3?raw=true", executable="C:\\Users\\davil\\OneDrive\\Desktop\\ffmpeg-master-latest-win64-gpl-shared\\bin\\ffmpeg.exe"))
    print(f"playing: {vc.is_playing()} paused: {vc.is_paused()}")
    await asyncio.sleep(2)
    await vc.disconnect()

Expected Results

The bot should disconnect from the VoiceChannel succesfully without raising any error

Actual Results

Exception in voice thread Thread-3
Traceback (most recent call last):
  File "C:\Coding prog\lib\site-packages\discord\player.py", line 746, in run
    self._do_run()
  File "C:\Coding prog\lib\site-packages\discord\player.py", line 739, in _do_run
    play_audio(data, encode=not self.source.is_opus())
  File "C:\Coding prog\lib\site-packages\discord\voice_client.py", line 686, in send_audio_packet
    self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
OSError: [WinError 10038] an operation was attempted on something that is not a socket

Intents

Irrelevants

System Information

Windows 11 Version 21H2 -- Build SO 22000.1098
Discord.py 2.0.1

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

This PR is a duplicate of

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@Snipy7374 and others