#๐Ÿ”’ Permission Denied (Errno 13)

37 messages ยท Page 1 of 1 (latest)

silver sierraBOT
#

@viral trout

Python help channel opened

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.

viral trout
#

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?

Code: https://paste.pythondiscord.com/RMQA

viral trout
#
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'
cursive zodiac
cursive zodiac
#

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?

viral trout
#

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

cursive zodiac
#

Could you test whether opening it in read mode works?

#
f = open('C:/Users/Mika/Desktop/BoucingBall/temp_chunks/temp_chunk.wav', 'r')
viral trout
#

reading a sound file?

cursive zodiac
#

Yeah. I mean just opening the file with python, to try to get an idea of what the issue could be.

viral trout
#

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

bleak canopy
viral trout
#

yup

bleak canopy
viral trout
#

or what do you mean?

bleak canopy
viral trout
#

ah, but no it isnt

bleak canopy
#

check task manager if its running in the background if thats not the case

viral trout
#

nothing there

bleak canopy
#

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

viral trout
#

same error with this

bleak canopy
#

can you paste the line of code you modified with this?

silver sierraBOT
#
Python help channel closed

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.