[python] Errno 13 Permission denied Python

In python, I am currently experimenting with what I can do with open command. I tried to open a file, and got an error message. Here's my code:

open(r'C:\Users\****\Desktop\File1')

My error message was:

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\****\\Desktop\\File1'

I looked on the website to try and find some answers and I saw a post where somebody mentioned chmod. 1. I'm not sure what this is and 2. I don't know how to use it, and thats why I've come here.

This question is related to python

The answer is


For future searchers, if none of the above worked, for me, python was trying to open a folder as a file.


The problem here is your user doesn't have proper rights/permissions to open the file this means that you'd need to grant some administrative privileges to your python ide before you run that command.

As you are a windows user you just need to right click on python ide => select option 'Run as Administrator' and then run your command.

And if you are using the command line to run the codes, do the same open the command prompt with admin rights. Hope it helps


If you have this problem in Windows 10, and you know you have premisions on folder (You could write before but it just started to print exception PermissionError recently).. You will need to install Windows updates... I hope someone will help this info.


If nothing worked for you, make sure the file is not open in another program. I was trying to import an xlsx file and Excel was blocking me from doing so.