#๐ Permission Denied (Errno 13)
37 messages ยท Page 1 of 1 (latest)
@viral trout
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Hey guys,
so I am making this Bouncing Ball thingy that everyone knows from tiktok.
But now I have a permission error (Errno 13). Does anyone knows why that is and how I can fix it?
Show your full traceback
Traceback (most recent call last):
File "c:\Users\Mika\Desktop\BoucingBall\main.py", line 107, in <module>
main(audio_file_path)
File "c:\Users\Mika\Desktop\BoucingBall\main.py", line 90, in main
play_chunk(chunks[chunk_index])
File "c:\Users\Mika\Desktop\BoucingBall\main.py", line 29, in play_chunk
chunk.export(temp_file, format="wav")
File "C:\Users\Mika\Desktop\BoucingBall\venv\lib\site-packages\pydub\audio_segment.py", line 867, in export
out_f, _ = _fd_or_path_or_tempfile(out_f, 'wb+')
File "C:\Users\Mika\Desktop\BoucingBall\venv\lib\site-packages\pydub\utils.py", line 60, in _fd_or_path_or_tempfile
fd = open(fd, mode=mode)
PermissionError: [Errno 13] Permission denied: 'C:/Users/Mika/Desktop/BoucingBall/temp_chunks\\temp_chunk.wav'
A common cause of this apparently is when the file you're trying to open is actually a folder, which can happen by mistake.
But here it isnt
Oh, have you checked in the file explorer?
Are you also running the program as a user that has permission to write to that file?
yes
I am running VS as an administrator and the file is on the same disk as vs code
I already gave extra permission to the file
but this windows account is the admin account so it shouldnt matter
Could you test whether opening it in read mode works?
f = open('C:/Users/Mika/Desktop/BoucingBall/temp_chunks/temp_chunk.wav', 'r')
reading a sound file?
Yeah. I mean just opening the file with python, to try to get an idea of what the issue could be.
opening the file with python isnt the problem
cause I once opened the song and it worked
even the first note of the song plays
Did you ensure the file path is correct?
yup
You can try closing the file while running the code
the file is always closed
or what do you mean?
like check if its open on another window or ur ide
ah, but no it isnt
check task manager if its running in the background if thats not the case
nothing there
Did you try using AudioSegment.from_file() to convert it to an exportable file
your error is originating from line 29 if im not mistaken, maybe you can try fixing it by using:
temp_file = AudioSegment.from_file("path/to/file.mp3", format="mp3")
temp_file.export(temp_file_dir, format="mp3")
im not sure whether this will work but try using this as an example to fix that
cuz the .export() function only works if u used AudioSegment
same error with this
can you paste the line of code you modified with this?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.