I'm super new on python and i am just deploying an open source app that was done in python and I'm getting a:
ImportError: cannot import name DataSource on from django.contrib.gis.gdal import DataSource
However, this is just fine:
import django.contrib.gis.gdal
My current environment setup is:
Could someone guide me here please?
If i could do import django.contribs.gis.gdal, how come DataSource cannot be imported? I assume DataSource is also part of the GDAL library?
Do you have python-gdal installed? It seems that django.contrib.gis.gdal only exposes the DataSource class if it is installed. At least on Ubuntu, installing python-django didn't install python-gdal by default.
EDIT: as noted in the comments below, you did have it installed, but the module responsible for locating it, django/contrib/gis/gdal/libgdal.py did not find it. If you peek in the source for that module (e.g. http://code.djangoproject.com/browser/django/branches/gis/django/contrib/gis/gdal/libgdal.py?rev=8012), there's a GDAL_LIBRARY_PATH setting that I think you could use to help Django find it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With