PermissionError: [Errno 13] Permission Denied: [Python Fix]

Try these solutions to fix PermissionError [Errno 13] Permission denied

Reading time icon 4 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read 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 the Python 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.

Ensure the file exists and you're using the correct file path to fix python permission denied error.

Run the os.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 the chomd 755 filename command and replace filename with the name of your file.

use chomd 755 to fix python permission denied error in windows 11.

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 the ls -al command will provide a list of files and directories and their permissions.

3. Adjust file permissions

  1. Navigate to the location of your file in file explorer.
  2. Right-click on the file and select Properties. open file properties.
  3. Click the Security tab then select your name under Group or user names. Open security tab.
  4. Select Edit and go through and check permissions. edit permissions to fix permission denied error.
  5. Click Apply then OK.

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

  1. Click on Start and open Settings (or press Windows + I).
  2. Open Apps then select Apps & features. open windows 11 apps and features.
  3. Open the drop-down menu next to More settings.
  4. Click App execution aliases. go to app execution aliases.
  5. Locate the two App Installers for python.exe and python3.exe and toggle both to Off. Disable python aliases to fix permission denied error in windows 11.

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

  1. Click on Start and open Settings (or press Windows + I).
  2. Scroll down and select Windows Update. Open windows update in settings.
  3. Perform any available updates.
  4. Select Advanced options. open windows 11 advanced options.
  5. Under Additional options, click on Optional updates. Do any optional updates to fix python permission denied error.
  6. Run any driver updates.

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.

Python version 3.10.7.

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 to open 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 our Try-except-print in Python guide.

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 on Cannot open shared object no such file or directory error, 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.

User forum

0 messages