Permissionerror: Permission Denied To Reading Csv File In Python
Solution 1:
In Windows, if you have the CSV file open (e.g. in Excel), and you run the script it cannot save to X_Data.csv
since the file is in use and raises the PermissionError
.
Close the file/Excel and try running your script again
Solution 2:
I think the User you are using to run the python file does not have Read (or if you want to change file and save it Write) permission over CSV file or it's directory.
If you are on Linux use CHMOD command to grant access the file:
public access: chmod 777 csv_file
And if you are on Windows change privacy and permissions of file and folder.
Solution 3:
In my case, I have not opened the file exactly but I have uploaded the same file in another application and that is the issue. So it was not allowed to read that file from another application. Once I close/refresh other application, python application able to read without any permission error.
Solution 4:
Whatever the other folks described is probably correct.
In my particular case:
The text file I am trying to read is on a shared drive on my work laptop. Corporations sync the shared drive so that you don't lose your data. With me this sync was the issue. I manually synced the folder and then I was able to read the file.
If the file is not synced, I doubt if you can even open the file. I tried and it said "Permission Denied" as it shows in jupyter notebook.
Post a Comment for "Permissionerror: Permission Denied To Reading Csv File In Python"