I am trying to run some Python code using the Python window in ArcGIS 10.1 that uses both the
gdal modules. However, when I try and import the
gdal module I get an error:
ImportError: No module named osgeo
Obviously it can't find the module, so I have added my main python site-packages directory to the
However, when I try and run
import osgeo or
from osgeo import gdal I get the following error:
Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 21, in <module> _gdal = swig_import_helper() File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 17, in swig_import_helper _mod = imp.load_module('_gdal', fp, pathname, description) ImportError: DLL load failed: %1 is not a valid Win32 application.
I've found various resources on the internet that seem to talk about similar problems (for example this question and this forum post, but they seem to be out-of-date (ie. not using ArcGIS 10.1) or not asking quite the same question.
Of course, importing
osgeo from a normal non-Arc Python window works fine, and I have compared
os.environ['PATH'] between the scripts and updated them so that they are the same, and it doesn't seem to fix the problem.
Does anyone have any idea how I can get this to work?