Perfect solution to Python error: PermissionError: [Errno 13] Permission denied

I will continue writing this blog. Everyone will move to this article first. If you still can’t solve the problem, read my article.Python error: PermissionError: [Errno 13] Permission denied_netcdf4 .dataset permission denied-CSDN Blog

Foreword: I think that for me, among so many tutorials on the Internet, this one is the most useful to me. After two times of practice, I have come to a clearer and more This is a systematic and effective way to solve this problem. I hope people who have read it will stop stepping on the trap. This process is so painful.

 Here’s the cool stuff:

First, before using the .load() function to read the json file, you must first give the file path. I believe everyone knows it, but here is a detail.

The last step in path is not the parent directory, but the original directory, that is, the last / following is a file rather than a folder, please give me the correct json The file itself.

Second, useos.chmod(path, stat.S_IRWXU) and import stat< /span>In two sentences, open all permissions to yourself to solve the error that occurs due to insufficient permissions as shown in the title.

So far, these are the two points. If you grasp these two points, you can avoid pitfalls, successfully compile and pass, and then use the load() function to read the json file.

 The following is my corrected code. Please pay attention to the relative positions of the several important statements I mentioned earlier as your reference.

Hot knowledge: You can warm the author all day long with one click and three consecutive hits (crazy hint~)

Guess you like

Origin blog.csdn.net/m0_64854963/article/details/134624088