<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Courier New, monospace"><font size="2">I'm
trying to install and use GDAL in Python, and there seems to be
something very fundamental that I'm missing.</font></font>
<p style="margin-bottom: 0cm;"><font face="Courier New, monospace"><font
size="2">To
start with the problem... In a new python file I write:</font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#0000ff">try</font><font
color="#000000">:</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font color="#000000"> </font><font
face="Courier New, monospace"><font size="2"><font
color="#0000ff"> from</font><font color="#000000">
osgeo </font><font color="#0000ff">import</font><font
color="#000000">
gdal</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#0000ff">except</font><font
color="#000000">
ImportError:</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font color="#000000"> </font><font
face="Courier New, monospace"><font size="2"><font
color="#0000ff"> import</font><font color="#000000">
gdal</font></font></font></p>
<br>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">When
run it replies:</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font color="#ff0000"><font
face="Courier New, monospace"><font size="2">Traceback
(most recent call last):</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font color="#ff0000">
</font><font face="Courier New, monospace"><font size="2"><font
color="#000080"><u>File
"C:\Martin\Work_Eclipse\Hilfe\src\check_GDAL.py", line 8,
in <module></u></font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font color="#ff0000"> <font
face="Courier New, monospace"><font size="2"> import
gdal</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#ff0000">ImportError:
No module named gdal</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><br>
</p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">To
me that translates into, Python can't find the GDAL modules.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">I'm
running on a win-xp computer, I use python 2.6 as I recently
upgraded
to ArcGIS 10. Before that I used GDAL with Python 2.5 (and
ArcGIS
9.x) that worked just fine.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">I
have no problems calling other Python add-ons, e.g. numpy.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font color="#000000"><font size="2">I
using GDAL from <a href="http://pypi.python.org/pypi/GDAL/">http://pypi.python.org/pypi/GDAL/</a></font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font color="#000000"><font size="2">I
downloaded
<a
href="http://download.osgeo.org/gdal/win32/1.6/gdalwin32exe160.zip">http://download.osgeo.org/gdal/win32/1.6/gdalwin32exe160.zip</a></font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">After
unzipping to a dir of my choice I included the …/bin dir in
my
'path' and created a 'GDAL_DATA' environment variable
pointing to
…/data</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">It
then looks like this:</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\>echo
%PATH%</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\WINDOWS\system32;...<shortened>...;C:\APPS\PRO\gdalwin32-1.6\bin</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\>echo
%GDAL_DATA%</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\APPS\PRO\gdalwin32-1.6\data</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">As
I read the installation guide it should do it – but it
doesn’t,
as the code sample above indicates.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">Though
not mentioned in the installation guide, I also created an
environmental variable PYTHONPATH, including the …/bin
directory</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\>echo
%PYTHONPATH%</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">C:\APPS\PRO\gdalwin32-1.6\bin</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">Unfortunately
this makes no deference to the program.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000"><b>Question
1</b></font><font color="#000000">: Are there any problems
in using
GDAL 1.6 with Python 2.6 on a win-xp?</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><br>
</p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">Looking
into ...\gdalwin32-1.6\bin\ in find no *.py files (nor
*.pyc)</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">I
would have expected some files with python extensions.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000">I
also expected a file with the name 'osgeo.*' or 'gdal.*',
since this
is what the Pyhon import statement try to import.
Alternatively a
.zip file with such files inside. But non of that is in the
...\gdalwin32-1.6\* to be found.</font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><b><font color="#000000">Question
2: </font></b><font color="#000000"><span
style="font-weight: normal;">Am
I missing something here? How is this binding supposed to
work? What file exactly is the import statement
supposed to find, that will enable it to include osgeo
functionality?</span></font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><br>
</p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000"><span
style="font-weight: normal;">Best
Regards</span></font></font></font></p>
<p style="margin-bottom: 0cm;" align="LEFT"><font face="Courier New,
monospace"><font size="2"><font color="#000000"><span
style="font-weight: normal;">Martin</span></font></font></font></p>
</body>
</html>