Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python error PermissionError: [Errno 13] how to solve Permission denied

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is a detailed introduction to "Python error PermissionError: [Errno 13] Permission denied how to solve". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "Python error PermissionError: [Errno 13] Permission denied how to solve" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of Xiaobian.

Problem Description:

I have been using python to process meteorological data, before writing a program to process meteorological data, has been able to use, but yesterday I want to process data when prompted me the following error

Traceback (most recent call last): ... File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\xarray\backends\file_manager.py", line 205, in _acquire_with_cache_info file = self._ opener(*self._ args, **kwargs) File "src\netCDF4\_netCDF4.pyx", line 2330, in netCDF4._ netCDF4.Dataset.__ init__ File "src\netCDF4\_netCDF4.pyx", line 1948, in netCDF4._ netCDF4._ ensure_nc_successPermissionError: [Errno 13] Permission denied: b'E:\\meteo\\metee\\longbasaba_19900530-19900930.nc'

As you can see from the last line, it seems to be rejecting my export data, and the error is in the location of the export data.

ds.to_netcdf(r'E:\meteo\metee\longbasaba_19900530-19900930.nc')

Then I went online to look up information. I looked up a lot of descriptions of the problem that were not very clear. I didn't do anything from last night to noon today. It was really a pit. Time was wasted on it. I have to write down the solution to this problem in order to avoid the pitfalls.

solutions

In fact, when I checked the problem yesterday, I didn't gain anything. Some of them, that is, they didn't have administrator privileges or something, so they were allowed to run as administrators. You can try running your python file as an administrator and see if it works. Even if it works, you can't run as administrator every time. So here's the solution I've given.

Step 1: Find the folder where your python file is located, right-click the properties to view the property status

My folder is set to read-only, pit dead Laozi, I do not know why they become read-only!!!

Step 2: Uncheck Read Only, then OK

Then try running your files directly and miracles will happen.

Of course, there may also be more minor problems, such as the file you want to write to is open or your code requires you to create the file yourself, which may also return this error.

with another solution.

The solution is as follows:

1. Check whether the file under the corresponding path exists and is occupied. If the file does not exist, find the corresponding file; if the file exists, occupied, will occupy the program temporarily closed.

2. Modify cmd permissions to run as administrator.

3. Check if the folder is open.

Read here, this article "Python error PermissionError: [Errno 13] Permission denied how to solve" article has been introduced, want to master the knowledge points of this article also need to do your own practice to understand, if you want to know more about the content of the article, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report