Errno13, Permission denied when trying to read file

20,200

Based on the name, I'm guessing that destPath is a directory, not a file. You can do a os.walk or a os.listdir on the directory, but you can't open it for reading. You can only call open on a file.

Maybe you meant to call open on one or more of the items from files

Share:
20,200
We're All Mad Here
Author by

We're All Mad Here

A curious mind left to explore the world of front end web development through complex projects

Updated on April 21, 2020

Comments

  • We're All Mad Here
    We're All Mad Here about 4 years

    I have created a small python script. With that I am trying to read a txt file but my access is denied resolving to an no.13 error, here is my code:

    import time
    import os
    
    destPath = 'C:\Users\PC\Desktop\New folder(13)'
    for root, dirs, files in os.walk(destPath):
    
    f=open(destPath, 'r')
    .....