Share this article
This article is translated in
Improve this guide
PermissionError: [Errno 13] Permission Denied: [Python Fix]
Try these solutions to fix PermissionError [Errno 13] Permission denied
4 min. read
Updated onOctober 4, 2024
updated onOctober 4, 2024
Share this article
This article is translated in
Improve this guide
Read our disclosure page to find out how can you help Windows Report sustain the editorial teamRead more
Python is designed to build websites, software, and more using a high-level programming language. However, users have recently reported receiving a permission denied error in Windows 11. Here’s how to fix PermissionError [Errno 13] Permission denied error in Python.
Because Python uses a general-purpose language, it can be used to build various programs rather than focusing on a specific variable.
For those wanting to learn more about developing and coding, Python is one of the easiest programming languages to learn, making it perfect for beginners.
Why do I get the permission denied error in Python?
Users encounter PermissionError: [Errno 13] Permission denied error if providing Python with a file path that does not have permission to open or edit the file. By default, some files do not allow certain permissions. This error may also occur if providing a folder rather than a file.
If the file is already being operated by another process, then you may encounter the permission denied error in Python. If you’re receiving thePython runtime error, we offer solutions for that as well.
How do I fix the Python permission denied error in Windows 11?
1. Check file path
One of the leading causes of PermissionError: [Errno 13] Permission denied is because Python is trying to open a folder as a file. Double-check the location of where you want to open the file and ensure there isn’t a folder that exists with the same name.
Run theos.path.isfile(filename)command replacing filename with your file to check if it exists. If the response is false, then the file does not exist, or Python cannot locate it.
2. Allow permissions using chomd
If the file does not have read and write permissions enabled for everyone, then you may encounter the permission denied error in Python. Try entering thechomd 755 filenamecommand and replacefilenamewith the name of your file.
This command gives everyone permission to read, write, and execute the file, including the owner. Users can also apply this command to entire directories. Running thels -alcommand will provide a list of files and directories and their permissions.
3. Adjust file permissions
Adjusting the permissions of the file that you’re trying to open will allow Python to read, write, and execute the file.
4. Turn off execution aliases
Python was added to the Microsoft Store for version 3.7 which introduced permission denied errors because it created two installers: python.exe and python3.exe. Disabling the Microsoft Store versions of Python should fix the permissions denied error.
5. Update Windows and drivers
If you’re suddenly encountering the Python permission denied error and none of the above solutions worked, then check for any Windows 11 updates and perform any available driver updates.
What is the latest version of Python?
As of the release of this article, the latest version of Python is 3.10.7, which is available for Windows 10 and newer and is not compatible with older versions, including Windows 7. Python supports Windows, macOS, Linux/UNIX, and more.
However, If users want to use older versions of Python, they can access releases 2.7 and newer, or they can download a specific version of a release.
If you want a quick way toopen PY files on Windows 10 and 11, we offer a guide for that as well. To learn how to deal with errors, be sure to visit ourTry-except-print in Pythonguide.
We also have a great guide on what to do if_xsrf argument missing from post, so don’t miss it. We also have a new guide onCannot open shared object no such file or directoryerror, so don’t miss it.
Hopefully, one of the above solutions helped you fix the Python permission denied error in Windows 11. Let us know in the comments which step worked for you or if you have any suggestions for a different solution.
Megan Moore
Megan is a Windows enthusiast and an avid writer. With an interest and fascination in all things tech, she enjoys staying up to date on exciting new developments in the computer and gaming world.
When not falling down a rabbit hole of tech news and information, she enjoys painting, watching movies, and taking her dramatic husky for long walks.
User forum
0 messages
Sort by:LatestOldestMost Votes
Comment*
Name*
Email*
Commenting as.Not you?
Save information for future comments
Comment
Δ
Megan Moore