PermissionError: [Errno 13] Permission denied: 'D:/XLRI/Term-4/ML'

62 Views Asked by At

I am new to Python. I am facing a permission error while writing a new CSV file. I tried opening the app as an administrator, but the error persists.

The line of code which generating the error and the error itself are:

kdta=pd.DataFrame(kdta)

kdta

kdta.to_csv("D:/XLRI/Term-4/ML")

PermissionError: [Errno 13] Permission denied: 'D:/XLRI/Term-4/ML'

Additional Details

  • working in Spyder
  • Python is Anaconda distribution
  • running in Administrator account
1

There are 1 best solutions below

2
On

Write permissions are needed in order to create a file in a folder.

If you are in Linux/Mac try chmod +w D:/XLRI/Term-4/ML (maybe you need sudo).

Also, it could be that the folder ML is from another owner. In that case you should try: chown -R $USER:$USER D:/XLRI/Term-4/ML (maybe you need sudo)

If you are in windows there are several ways to allow a folder to be written in. Check out this link: https://www.makeuseof.com/tag/fix-access-denied-folders-windows-10/