planetfederal / django-osgeo-importer

Do not use this repo, use https://github.com/GeoNode/django-osgeo-importer
GNU General Public License v3.0
2 stars 1 forks source link

When one file is a .zip containing a copy of another file in the same upload batch, Importer fails #24

Closed sarasafavi closed 8 years ago

sarasafavi commented 8 years ago

Given the following files:

foo.zip: contains a copy of bar.zip bar.zip: contains baz.tif, etc

The following traceback occurs:

IOError at /uploads/new
[Errno 2] No such file or directory: u'/tmp/tmpeh7O5t/bar.zip'
Request Method: POST
Request URL:    http://exchange/uploads/new
Django Version: 1.8.15
Exception Type: IOError
Exception Value:    
[Errno 2] No such file or directory: u'/tmp/tmpeh7O5t/bar.zip'
Exception Location: /usr/local/lib/python2.7/shutil.py in copyfile, line 82
Python Executable:  /env/bin/python
Python Version: 2.7.11
Python Path:    
['/mnt/exchange',
 '/env/lib/python27.zip',
 '/env/lib/python2.7',
 '/env/lib/python2.7/plat-linux2',
 '/env/lib/python2.7/lib-tk',
 '/env/lib/python2.7/lib-old',
 '/env/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7',
 '/usr/local/lib/python2.7/plat-linux2',
 '/usr/local/lib/python2.7/lib-tk',
 '/env/lib/python2.7/site-packages',
 '/mnt/geonode',
 '/mnt/importer',
 '/mnt/exchange',
 '/mnt/exchange',
 '/mnt/exchange']
Server time:    Mon, 26 Sep 2016 17:18:35 -0500
Environment:

Request Method: POST
Request URL: http://exchange/uploads/new

Django Version: 1.8.15
Python Version: 2.7.11
Installed Applications:
('djmp',
 'hypermap.aggregator',
 'hypermap.dynasty',
 'hypermap.search',
 'hypermap',
 'appearance',
 'flat',
 'exchange.core',
 'geonode',
 'geonode.contrib.geogig',
 'geonode.contrib.slack',
 'django_classification_banner',
 'maploom',
 'solo',
 'haystack',
 'corsheaders',
 'osgeo_importer',
 'modeltranslation',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'django.contrib.messages',
 'django.contrib.humanize',
 'django.contrib.gis',
 'pagination',
 'taggit',
 'treebeard',
 'friendlytagloader',
 'geoexplorer',
 'leaflet',
 'django_extensions',
 'autocomplete_light',
 'mptt',
 'djcelery',
 'storages',
 'pinax_theme_bootstrap_account',
 'pinax_theme_bootstrap',
 'django_forms_bootstrap',
 'account',
 'avatar',
 'dialogos',
 'agon_ratings',
 'announcements',
 'actstream',
 'user_messages',
 'tastypie',
 'polymorphic',
 'guardian',
 'geonode.people',
 'geonode.base',
 'geonode.layers',
 'geonode.maps',
 'geonode.proxy',
 'geonode.security',
 'geonode.social',
 'geonode.catalogue',
 'geonode.documents',
 'geonode.api',
 'geonode.groups',
 'geonode.services',
 'geonode.geoserver',
 'geonode.upload',
 'geonode.tasks')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'pagination.middleware.PaginationMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'geonode.security.middleware.LoginRequiredMiddleware',
 'geonode.security.middleware.LoginRequiredMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware')

Traceback:
File "/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/env/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  22.                 return view_func(request, *args, **kwargs)
File "/env/lib/python2.7/site-packages/django/views/generic/base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)
File "/env/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch
  89.         return handler(request, *args, **kwargs)
File "/env/lib/python2.7/site-packages/django/views/generic/edit.py" in post
  215.             return self.form_valid(form)
File "/mnt/importer/osgeo_importer/views.py" in form_valid
  177.             shutil.move(each.name, tofile)
File "/usr/local/lib/python2.7/shutil.py" in move
  302.             copy2(src, real_dst)
File "/usr/local/lib/python2.7/shutil.py" in copy2
  130.     copyfile(src, dst)
File "/usr/local/lib/python2.7/shutil.py" in copyfile
  82.     with open(src, 'rb') as fsrc:

Exception Type: IOError at /uploads/new
Exception Value: [Errno 2] No such file or directory: u'/tmp/tmpeh7O5t/bar.zip'
ghost commented 8 years ago

Moved to https://github.com/GeoNode/django-osgeo-importer/issues/49