'os.rename python socket OSError: [WinError 10038] an operation was attempted on something that is not a socket
I need to rename a file, that was previously downloaded, so I dont have the exact filename. This was my approach:
for file in os.listdir("./"):
if file.endswith(".mp3"):
os.rename(file, "song.mp3")
I get this error:
OSError: [WinError 10038] an operation was attempted on something that is not a socket
full error message:
(flashmich) C:\Users\user\Desktop\python\Flashmich>python FlashMich.py
[youtube] 7h7ntYLLrfQ: Downloading webpage
[download] Destination: Mark Forster - Kogong-7h7ntYLLrfQ.webm
[download] 100% of 3.53MiB in 01:02
[ffmpeg] Destination: Mark Forster - Kogong-7h7ntYLLrfQ.mp3
Deleting original file Mark Forster - Kogong-7h7ntYLLrfQ.webm (pass -k to keep)
Mark Forster - Kogong-7h7ntYLLrfQ.mp3
Exception in voice thread Thread-9
Traceback (most recent call last):
File "C:\Users\user\Desktop\python\Flashmich\lib\site-packages\discord\player.py", line 603, in run
self._do_run()
File "C:\Users\user\Desktop\python\Flashmich\flashmich\lib\site-packages\discord\player.py", line 596, in _do_run
play_audio(data, encode=not self.source.is_opus())
File "C:\Users\user\Desktop\python\Flashmich\flashmich\lib\site-packages\discord\voice_client.py", line 638, in send_audio_packet
self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
OSError: [WinError 10038] Ein Vorgang bezog sich auf ein Objekt, das kein Socket ist
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000172C7D8D820>
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python39\lib\asyncio\proactor_events.py", line 116, in __del__
File "c:\users\user\appdata\local\programs\python\python39\lib\asyncio\proactor_events.py", line 108, in close
File "c:\users\user\appdata\local\programs\python\python39\lib\asyncio\base_events.py", line 746, in call_soon
File "c:\users\user\appdata\local\programs\python\python39\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
I am not dealing with any sockets so I am really confused
(I am working in a virtual env if that is important)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
