This is my error I get. I searched some Stuff and I still dont get it…
Some are saying with the command: “sudo” it will work. But with sudo it is in the terminal and how I should write it there I dont know but this is not what I want.
Im writing the code in Visual Studio Code… I also took the Visual Studio Code into the Seduritylist. That Visual Studio Code read/write and so on… but this it is still not working…
On my Windows PC everything is working… but Im new to the Macbook and Linux Stuff. And I cant find any solution… everything I find is… like " write in the Terminal sudo "
Everything I tried now is not working…
I want that when I execute my code that the code doing everything.
How familiar are you with Linux and macOS permission system? In your downloads, check the permission of your censor dispenser (you can use ls -l in the command line)
i highly recommend reading about permissions on the internet. Something like this:
Hello, let’s try with ownership of the given file: navigate to the file’s folder in terminal, then type:
groups
this will show a list of groups the current account belongs to.
you will have normally a group with the same name as your user. If so, then try to take the ownership of the file you want to read with python. In the terminal, type:
sudo chown username:group email_one.txt
Replace username and group with yours. If nothing happens, you are now the owner of the file. You can check the ownership of files by typing:
ls -l
you will see a list of files in current folder, permissions, file owner. Taking ownership of a file is the easiest route. The error you are getting is probably because you imported that file from somewhere and its restringed for security. I hope it helps…
You are right. I am just trying to make his life easier when a file comes from elsewhere (say, a Windows PC), changing permissions is futile. I have hit with that rock a lot
I’d kinda like to think that a user that was able to create a file would be able to read it or at the very least be able to change permissions without sudo.
I get it if it’s an already existing file on an usb or other external media but this involved creating the file.
The permissions of the files in that zip archive are -rw-r–r-- , if some archive manager is ignoring what the zip archive specifies and also doesn’t give the user read permission … that’s quite funny
email_one = open("C:\\Users\\w3ro\\Documents\\email_one.txt", "r")
email_one_censored = open("C:\\Users\\w3ro\\Documents\\email_one_censored.txt", "w")
email_two = open("C:\\Users\\w3ro\\Documents\\email_two.txt", "r")
email_two_censored = open("C:\\Users\\w3ro\\Documents\\email_two_censored.txt", "w")
for line in email_one:
email_one_censored.write(line.replace('learning algorithms', '+++++++++++'))
email_one.close()
email_one_censored.close()
email_one_censored = open("C:\\Users\\w3ro\\Documents\\email_one_censored.txt","r").read()
print(email_one_censored)
This works fine in Windows… I run it and it works.
email_one = open("/Users/w3ro/Downloads/censor_dispenser/email_one.txt", "r")
email_one_censored = open("/Users/w3ro/Downloads/censor_dispenser/email_one_censored.txt", "w")
email_two = open("/Users/w3ro/Downloads/censor_dispenser/email_two.txt", "r").read()
email_two_censored = open("/Users/w3ro/Downloads/censor_dispenser/email_two_censored.txt", "w")
for line in email_one:
email_one_censored.write(line.replace('learning algorithms', '++++++++++'))
email_one.close()
email_one_censored.close()
email_one_censored = open("/Users/w3ro/Downloads/censor_dispenser/email_one_censored.txt","r").read()
print(email_one_censored)
and this on a Mac also in VisualStudioCode
okay I found the Problem… I did what corotox wrote. Thank you
I also read about the Permissions thank you stetim94
The file was in the Downloads folder and it seems that this folder has special permissions…
so I put the censor dispencer into the Documents folder and finally it works well…
The Problem with the Downloads folder will stay for the moment it took now several days to figure it out …