48👍
You need to change the directory permission so that web server process can change the directory.
-
To change ownership of the directory, use
chown
:chown -R user-id:group-id /path/to/the/directory
-
To see which user own the web server process (change
httpd
accordingly):ps aux | grep httpd | grep -v grep
OR
ps -efl | grep httpd | grep -v grep
24👍
This may also happen if you have a slash before the folder name:
path = '/folder1/folder2'
OSError: [Errno 13] Permission denied: '/folder1'
comes up with an error but this one works fine:
path = 'folder1/folder2'
- [Django]-How to put comments in Django templates?
- [Django]-Multiple annotate Sum terms yields inflated answer
- [Django]-How to get request object in django unit testing?
1👍
Probably you are facing problem when a download request is made by the maybe_download function call in base.py file.
There is a conflict in the permissions of the temporary files and I myself couldn’t work out a way to change the permissions, but was able to work around the problem.
Do the following…
- Download the four .gz files of the MNIST data set from the link ( http://yann.lecun.com/exdb/mnist/ )
- Then make a folder names MNIST_data (or your choice in your working directory/ site packages folder in the tensorflow\examples folder).
- Directly copy paste the files into the folder.
- Copy the address of the folder (it probably will be
( C:\Python\Python35\Lib\site-packages\tensorflow\examples\tutorials\mnist\MNIST_data )) - Change the “\” to “/” as “\” is used for escape characters, to access the folder locations.
- Lastly, if you are following the tutorials, your call function would be ( mnist = input_data.read_data_sets(“MNIST_data/”, one_hot=True) ) ;
change the “MNIST_data/” parameter to your folder location. As in my case would be ( mnist = input_data.read_data_sets(“C:/Python/Python35/Lib/site-packages/tensorflow/examples/tutorials/mnist/MNIST_data”, one_hot=True) )
Then it’s all done.
Hope it works for you.
- [Django]-Annotate a queryset with the average date difference? (django)
- [Django]-Django model constraint for related objects
- [Django]-Django's Double Underscore
- [Django]-How to completely uninstall a Django app?
- [Django]-What is more efficient .objects.filter().exists() or get() wrapped on a try
- [Django]-What's the recommended approach to resetting migration history using Django South?
1👍
supplementing @falsetru’s answer : run id in the terminal to get your user_id and group_id
Go the directory/partition where you are facing the challenge.
Open terminal, type id then press enter.
This will show you your user_id and group_id
then type
chown -R user-id:group-id .
Replace user-id and group-id
.
at the end indicates current partition / repository
// chown -R 1001:1001 . (that was my case)
- [Django]-Django: Does prefetch_related() follow reverse relationship lookup?
- [Django]-ValueError: The field admin.LogEntry.user was declared with a lazy reference
- [Django]-CSRF validation does not work on Django using HTTPS
- [Django]-Django Cache cache.set Not storing data
- [Django]-Altering one query parameter in a url (Django)
- [Django]-How do I add a custom column with a hyperlink in the django admin interface?
0👍
Just close the file in case it is opened in the background. The error disappears by itself
- [Django]-Django: Does prefetch_related() follow reverse relationship lookup?
- [Django]-CSRF validation does not work on Django using HTTPS
- [Django]-Malformed Packet: Django admin nested form can't submit, connection was reset
0👍
The solution that worked out for me here when I was using python 3 os package for performing operations on a directory where I didn’t have sufficient permissions and access to got resolved by running the python file with sudo (root) i.e.:
sudo python python_file_name.py
Any other utility that you might also plan on using to chmod or chown that directory would also only work when you run it with sudo.
# file_name.py
base_path = "./parent_dir/child_dir/"
user = os.stat(base_path).st_uid # for getting details of the current user owner of the dir
group = os.stat(base_path).st_gid # for getting details of the current group owner of the dir
print("Present owner and group of the specified path")
print("Owner:", user)
print("Group:", group)
os.chown(base_path, user, group) # change directory permissions
print("\nOwner id of the file:", os.stat(base_path).st_uid)
print("Group id of the file:", os.stat(base_path).st_gid)
os.mkdir(base_path+file_name,mode=0o666)
run the above file with sudo.
sudo python file_name.py
Hope this answer works out for you.
Forever indebted to stackoverflow and the dev community. All hail the devs.
- [Django]-How to delete a record in Django models?
- [Django]-Django nested transactions – “with transaction.atomic()”
- [Django]-Django upgrading to 1.9 error "AppRegistryNotReady: Apps aren't loaded yet."