<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Casper,<br>
    <br>
    I think you'll need to start from as clean an environment as
    possible and add items to path until things break again.<br>
    For example, from a command shell (start &gt; run &gt; cmd.exe):<br>
    <br>
    {{{<br>
    :: clear whole PATH<br>
    set path=<br>
    <br>
    :: clear PYTHONPATH, PYTHONHOME<br>
    set pythonpath=<br>
    set pythonhome=<br>
    <br>
    :: set basic o4w environment<br>
    cd /d c:\osgeo4w<br>
    set osgeo4w_root=%cd%<br>
    path=%osgeo4w_root%\bin<br>
    }}}<br>
    <br>
    Now run python and import gdal.  <br>
    <br>
    If it works, from the same command shell run each bat in
    "osgeo4w\etc\ini" and test the python import again until something
    fails.<br>
    <br>
    If it doesn't work, something is wrong with the current o4w package
    ecosystem and we'll try and dig it out.<br>
    <br>
    If you get through all the ini bat's without error, then the problem
    lies somewhere in the host Windows environment. Likely culprits
    include things like other python directories or .dll's in PATH,
    PYTHONPATH or PYTHONHOME (not necessarily gdal dll's).<br>
    <br>
    let us know how you make out,<br>
    <br>
    <br>
    <pre class="moz-signature" cols="72">matt wilkie
--------------------------------------------
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
<a class="moz-txt-link-freetext" href="http://environmentyukon.gov.yk.ca/geomatics/">http://environmentyukon.gov.yk.ca/geomatics/</a>
-------------------------------------------- </pre>
    <br>
    On 07-May-2012 11:40 PM, Casper Børgesen (CABO) wrote:
    <blockquote
      cite="mid:BCF6B63AE0B25941A7F56567B58A2805AA88C5@allkexa1.NIRAS.INT"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";
        mso-fareast-language:DA;}
span.pun
        {mso-style-name:pun;}
span.pln
        {mso-style-name:pln;}
span.typ
        {mso-style-name:typ;}
span.kwd
        {mso-style-name:kwd;}
span.str
        {mso-style-name:str;}
span.lit
        {mso-style-name:lit;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 2.0cm 3.0cm 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal">Hi! <o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal"><span lang="EN-US">I am new to the GDAL
            world and I’m struggling with installing OSGeo4W to a
            working state.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I have downloaded and
            installed the latest edition OSGeo4W. The install goes
            smoothly. I open the OSGeo4W Command shell and enter Python.
            I have seen that I can test the basic Python/GDAL binding(?)
            by entering<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">&gt;&gt;&gt; from osgeo
            import gdal<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">This results in the
            following error:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:10.0pt;font-family:&quot;Courier
            New&quot;;mso-fareast-language:DA" lang="EN-US">Traceback
            (most recent call last):<br>
              File "&lt;stdin&gt;", line 1, in &lt;module&gt;<br>
              File
            "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
            line 21,<br>
            in &lt;module&gt;<br>
                _gdal = swig_import_helper()<br>
              File
            "C:\OSGeo4W\apps\Python27\lib\site-packages\osgeo\__init__.py",
            line 17,<br>
            in swig_import_helper<br>
                _mod = imp.load_module('_gdal', fp, pathname,
            description)<br>
            ImportError: DLL load failed: The operating system cannot
            run %1.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I have read that this
            error might indicate that the installed python/gdal
            libraries are incompatible, but I’m wondering if my OSGeo4W
            installation is obstructed by another installation? The
            following three lines are added to my path by the OSGeo4W
            Command shell:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <pre><span class="pln"><span lang="EN-US">C</span></span><span class="pun"><span lang="EN-US">:\</span></span><span class="typ"><span lang="EN-US">OSGeo4W</span></span><span class="pun"><span lang="EN-US">\</span></span><span class="pln"><span lang="EN-US">bin</span></span><span lang="EN-US">
<span class="pln">C</span><span class="pun">:\</span><span class="typ">OSGeo4W</span><span class="pun">\\</span><span class="pln">apps</span><span class="pun">\</span><span class="pln">msys</span><span class="pun">\</span><span class="pln">bin</span>
<span class="pln">C</span><span class="pun">:\</span><span class="typ">OSGeo4W</span><span class="pun">\\</span><span class="pln">apps</span><span class="pun">\</span><span class="typ">Python27</span><span class="pun">\</span><span class="typ">Scripts</span><o:p></o:p></span></pre>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I have searched through
            my system looking for gdal*.dll, but I have found none
            located within any of the folders in my PATH.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">What can I do to
            troubleshoot this problem?<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Regards, Casper<o:p></o:p></span></p>
      </div>
    </blockquote>
  </body>
</html>