Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionError at /admin/raster/rasterlayer/add/ #45

Open
maulanarachmat opened this issue Jan 2, 2020 · 7 comments
Open

PermissionError at /admin/raster/rasterlayer/add/ #45

maulanarachmat opened this issue Jan 2, 2020 · 7 comments

Comments

@maulanarachmat
Copy link

maulanarachmat commented Jan 2, 2020

I'm trying to add raster into Raster layers using admin page,
but everytime i tried it always give [WinError 32],
I already tried to change permission on admin page and remove the file on temp data but still got the error.

I'm using Windows 10, PostgreSQL 11.4, PostGIS 2.5.3 and Python 3 using virtual env from conda.
My data only have 1 band (grayscale)

Here's the traceback error:

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/raster/rasterlayer/add/

Django Version: 2.2.6
Python Version: 3.7.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis',
'raster',
'ras.apps.RasConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\tasks.py" in create_tiles
40. parser.reproject_rasterfile()

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\tiles\parser.py" in reproject_rasterfile
206. dest_zip = zipfile.ZipFile(dest.name, 'w', allowZip64=True)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\zipfile.py" in init
1204. self.fp = io.open(file, filemode)

During handling of the above exception ([Errno 13] Permission denied: 'C:\Users\DELL\AppData\Local\Temp\tmpaadzqk14\tmpmp_6awy2.zip'), another exception occurred:

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\core\handlers\base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\core\handlers\base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\options.py" in wrapper
606. return self.admin_site.admin_view(view)(*args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\utils\decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\sites.py" in inner
223. return view(request, *args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\options.py" in add_view
1634. return self.changeform_view(request, None, form_url, extra_context)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\utils\decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\utils\decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\options.py" in changeform_view
1522. return self._changeform_view(request, object_id, form_url, extra_context)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\options.py" in _changeform_view
1561. self.save_model(request, new_object, form, not add)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\contrib\admin\options.py" in save_model
1088. obj.save()

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\db\models\base.py" in save
741. force_update=force_update, update_fields=update_fields)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\db\models\base.py" in save_base
790. update_fields=update_fields, raw=raw, using=using,

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\dispatch\dispatcher.py" in send
175. for receiver in self._live_receivers(sender)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\django\dispatch\dispatcher.py" in
175. for receiver in self._live_receivers(sender)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\models.py" in parse_raster_layer_if_status_is_unparsed
243. parse(instance.id)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\tasks.py" in parse
131. all_in_one(rasterlayer_id, zoom_range)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\celery\local.py" in call
191. return self._get_current_object()(*a, **kw)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\celery\app\task.py" in call
392. return self.run(*args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\tasks.py" in all_in_one
77. create_tiles(rasterlayer_id, zoom_range, True)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\celery\local.py" in call
191. return self._get_current_object()(*a, **kw)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\celery\app\task.py" in call
392. return self.run(*args, **kwargs)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\site-packages\raster\tasks.py" in create_tiles
50. shutil.rmtree(parser.tmpdir)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\shutil.py" in rmtree
513. return _rmtree_unsafe(path, onerror)

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\shutil.py" in _rmtree_unsafe
397. onerror(os.unlink, fullname, sys.exc_info())

File "C:\Users\DELL\Anaconda3\envs\earth-analytics-python\lib\shutil.py" in _rmtree_unsafe
395. os.unlink(fullname)

Exception Type: PermissionError at /admin/raster/rasterlayer/add/
Exception Value: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\DELL\AppData\Local\Temp\tmpaadzqk14\test.tif_copy.GTiff'

@Yottox
Copy link

Yottox commented Feb 24, 2020

Any solutions?

@yellowcap
Copy link
Member

I don't have access to a Windows computer so I can't really debug this. It looks like the "closing" of a file from one function might not be registered properly and so the final removing of the intermediate files fails. Maybe when Celery tries to access it after the admin form uploaded it to the web server?

@yellowcap
Copy link
Member

Could you try to run django-raster without celery (RASTER_USE_CELERY=False) https://django-raster.readthedocs.io/en/stable/settings.html#asynchronous-raster-parsing and see if it works that way just to see if its a celery related problem?

@kshitijrajsharma
Copy link

Still same problem occurs any solution found ?
image

@dksivagis
Copy link

Hi,
Any ideas how to solve this problem on windows.
I am also stuck in the same problem.
Help me how to to debug this issue.

@kshitijrajsharma
Copy link

Hi,
Any ideas how to solve this problem on windows.
I am also stuck in the same problem.
Help me how to to debug this issue.

I shifted to ubuntu yet couldn't solve the issue

@seema30fresher
Copy link

Hi,
I am also stuck with the same problem.
Is anybody found the solution?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants