3

I am using netCDF4 and python 3.4.

I run the following line of code in order to start writing a new netCDF file that I will be filling with data later in my code following netcdf4 documentation. I however keep getting this error...

File "netCDF4.pyx", line 1466, in netCDF4.Dataset.__init__ (netCDF4.c:19692) RuntimeError: Permission denied

from netCDF4 import Dataset
rootgrp = Dataset('test.nc', 'w', format='NETCDF4')

Any help will be most appreciated.

3 Answers 3

6

The "Permission denied" part of the error leads me to believe you don't have permissions to write to the current directory (wherever you are when you run your script).

Check your permissions and/or try giving a full path to put the file in a directory you know you can write to.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. That was the exact problem.
1

dataset.close()

or close ide and delete file 'netCDF4.pyx'

maybe a file exist there, so can't write it.

Comments

0

In my case, this error arises when I am running python by crontab.

The solution is to add following line at the beginning of crontab file.

HDF5_USE_FILE_LOCKING=FALSE

1 Comment

This is resolve my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.