Cannot run python script unless its run in VSCODE or i change the script location to the python3.10 folder

23 Views Asked by At

In my python script, I am using a csv file, which according to terminal has read and write permissions for the user, staff, and everyone. According to sharing and permissions in get info, the same is reflected. However when i run this line of code in python IDLE, f = open("lounges.csv", "r")

This error is shown. PermissionError: [Errno 1] Operation not permitted: 'lounges.csv'

This error only occurs when i have my csv file and python script in a place other than my python 3.10 folder and then run in IDLE. In VSCODE and mac terminal, my code seems to run fine without this error.

I have tried changing permissions using chmod 777 lounges.csv, only to get this message. chmod: lounges.csv: No such file or directory

When i use the command ls -la to check the file permissions, lounges.csv is shown.
-rwxrwxrwx@ 1 john staff 10135 Sep 23 09:04 lounges.csv

0

There are 0 best solutions below