<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Verdana","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1492797767;
        mso-list-type:hybrid;
        mso-list-template-ids:-701857324 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l1
        {mso-list-id:1981374868;
        mso-list-type:hybrid;
        mso-list-template-ids:1494923330 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l2
        {mso-list-id:2130590427;
        mso-list-type:hybrid;
        mso-list-template-ids:234672548 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Tamas,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>I think with either option #2 or #3, gdal.py will have to be modified in order for everything to be invisible to the user. In #2, gdal.py would have to modify the PATH variable. In #3, it would have to import the _gdal_dll_helper module. In either case, it would just be a few lines of code at the top of the file that occurs before any other GDAL extension modules are loaded (_gdal, _gdal_array, etc). It would also need to be done for other modules such as ogr.py, osr.py, or whatever also imports GDAL extension modules (unless those ones also import gdal.py first).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>So #3 is not better by virtue of not having to modify the bindings; it does have to modify the bindings. But #3 is appealing because setting the PATH from Python code sometimes has weird issues. For example, when I tried it in my code, it produced a weird problem when I tried to use the &#8220;nose&#8221; Python testing framework to run test cases that involved calling Python modules from GDAL and ArcGIS. The problem there may ultimately be a Microsoft issue in which the environment settings for a process are maintained by the Microsoft C runtime library (msvcrt*.dll) and Python, ArcGIS, and GDAL may use different versions of that library. I do not want to digress into this here, but suffice to say, I prefer #3 to #2 because it did not have this problem.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Here is an outline of tasks. We probably should put it in an RFC to keep track.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Modify the makefiles for your SDK so that it runs release-XXXX-dev\gdal\swig\python\setup.py with the &#8220;bdist --formats=wininst&#8221; option. This will produce an installation program such as gdal-1.7.3.win32-py2.5.exe. This is what the user will run to install the Python bindings together with a private copy of the GDAL DLLs used just by those bindings. On Python 2.6 and later, we probably want &#8220;bdist --formats=msi&#8221; to produce a .msi file rather than a .exe, because Windows likes .msi files much better than .exes for security purposes. IIRC, Python 2.5 and earlier do not have the msi option.<o:p></o:p></span></p><p class=MsoListParagraph><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Modify release-XXXX-dev\gdal\swig\python\setup.py to include the GDAL DLLs and data files in the data_files list that is passed to the setup() function. Make sure it is only done for Windows (Python code can check that). The goal is to have the installation program create the following kind of installation:<o:p></o:p></span></p><p class=MsoListParagraph><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Existing Python bindings:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\gdal.py<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\ogr.py<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\...<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\_gdal.pyd<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\_ogr.pyd<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\...<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>New bin, data, and plugins directories, which are private to this installation of the bindings:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\gdal17.dll<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\proj.dll<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\...<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\gdal-data\coordinate_axis.csv<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\gdal-data\...<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\gdal-plugins\ogr_PG.dll<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>C:\PythonXX\Lib\site-packages\osgeo\bin\gdal-plugins\...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Introduce a new file release-XXXX-dev\gdal\swig\python\extensions\_gdal_dll_loader.cpp. This file will call GetDllDirectory to find the current DLL directory setting, call SetDllDirectory to C:\PythonXX\Lib\site-packages\osgeo\bin (or wherever the Python instance is installed), call LoadLibrary(&quot;gdal17.dll&quot;), and call SetDllDirectory back to what it was before. There are more details to consider. For example, we might want to have it call LoadLibrary first to see if it can load the GDAL DLL from the PATH, allowing the user to use their own GDAL DLLs without having to overwrite the ones in the Python directory. Or we might <u>not</u> want to do that, with the idea that the GDAL Python bindings must be tightly coupled to a particular version of GDAL&#8217;s DLLs.<o:p></o:p></span></p><p class=MsoListParagraph><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Modify setup.py to compile _gdal_dll_loader.cpp, only for Windows. This will result in _gdal_dll_loader.pyd alongside the other .pyd files.<o:p></o:p></span></p><p class=MsoListParagraph><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>5.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Modify gdal.py, osr.py, and so on to do something like this:<o:p></o:p></span></p><p class=MsoListParagraph><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>import sys<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>if sys.platform == 'win32':&nbsp;&nbsp;&nbsp;&nbsp; # TODO: add check for Windows x64 as well<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; try:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import osgeo._gdal_dll_loader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # As part of this, Python will call an &#8220;init&#8221; function inside. That function will do the SetDllDirectory, etc.<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp; except:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:1.0in'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l2 level1 lfo1'><![if !supportLists]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>6.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Do whatever is necessary to ensure the GDAL_DATA etc are properly set up inside GDAL. I can&#8217;t remember if this will &#8220;just work&#8221; using directories named gdal-data, gdal-plugins, or if it is necessary for the _gdal_dll_loader.pyd to call some GDAL functions to make it happen.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Does that sound like the right direction?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Jason<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Tamas Szekeres [mailto:szekerest@gmail.com] <br><b>Sent:</b> Thursday, January 06, 2011 11:07 AM<br><b>To:</b> Jason Roberts<br><b>Cc:</b> gdal-dev@lists.osgeo.org<br><b>Subject:</b> Re: Fwd: Re: [gdal-dev] FWTools and GDAL 1.7.0<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>2011/1/6 Jason Roberts &lt;<a href="mailto:jason.roberts@duke.edu">jason.roberts@duke.edu</a>&gt;<o:p></o:p></p><div><div><p><span style='font-size:10.0pt;color:#1F497D'>2.</span><span style='font-size:7.0pt;color:#1F497D'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;color:#1F497D'>Build an installation package as above. Have it install the GDAL DLLs as a subdirectory of the osgeo directory, e.g. C:\PythonXY\Lib\site-packages\osgeo\bin. Modify gdal.py to set os.environ['PATH'] = os.environ['PATH'] + ';' gdalInstallDir to modify the PATH to include that directory prior to importing _gdal.pyd. The PATH will be modified for the running process only, for the duration of that process.</span><o:p></o:p></p><p><span style='font-size:10.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p><p><span style='font-size:10.0pt;color:#1F497D'>3.</span><span style='font-size:7.0pt;color:#1F497D'>&nbsp;&nbsp;&nbsp; </span><span style='font-size:10.0pt;color:#1F497D'>Same as #2 but rather than modifying gdal.py to set the PATH variable, instead create a new Python extension module called _gdal_dll_helper.pyd. The job of this C extension module is simply to get gdal.dll and other DLLs loaded without resorting to modifying the system PATH which can sometimes have weird consequences (I can explain more if needed). The extension module would call the Windows <a href="http://msdn.microsoft.com/en-us/library/ms686203%28v=vs.85%29.aspx" target="_blank">SetDllDirectory</a> function, call LoadLibrary to explicitly load gdal17.dll into the current process, then call SetDllDirectory again to set the DLL directory back to what it was previously. Then, when gdal.py wants to load _gdal.pyd, gdal17.dll is already loaded and the binding succeeds.</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;color:#1F497D'>I know #2 and #3 sound scary but they can be done cleanly. I currently use a variation of #3 in my own project that embeds GDAL and its Python bindings.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>Jason,<br><br>Good writeup, thanks for that. You mention #2 and #3 which is exactly the same I have in my mind. Already posted a code for #2 related to the csharp bindings to demonstrate this option.<br><br>#2 would be fairly transparent for the user (no additional modules imported), the only thing we could add is how gdal.py would find out the install location of the gdal files. This may probably set in the registry added by the installer. Not sure how this addition would affect the gdal binding on other platforms (if we implement this in gdal)<br><br>#3 seems to be better for gdal (doesn't require to modify the bindings) however the user will require to use an additional module (which is not required normally when using gdal.py)<br><br><br>I would personally vote on having an extension (like #3) which is imported by gdal.py in case if it is installed. If this extension is not installed, gdal.py would work as before. This extension would scan the registry to find out the install location of the corresponding files (probably based on an unique key) and perform the required actions to make the dll-s loadable.<br><br><br>Best regards,<br><br>Tamas<br><br><br><o:p></o:p></p></div></body></html>