<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Dr. Armi,<br><br><br><div>> Date: Thu, 14 Aug 2014 14:44:58 +0200<br>> From: Armin.R.Schmidt@Gmail.com<br>> To: gdal-dev@lists.osgeo.org<br>> Subject: [gdal-dev] Problems packaging with py2exe<br>> <br>> I am trying to package my GDAL/OGR Python project with py2exe so that<br>> the users don't need to do a separate GDAL installation, but I can't get <br>> it to work.<br>> <br>> As an example, this simple two-line program results in the error message <br>> below when the final .exe file is called.<br>> <br>> import osgeo.gdal as gdal<br>> print __name__<br>> <br>> Traceback (most recent call last):<br>> File "temp.py", line 1, in <module><br>> File "osgeo\__init__.pyc", line 21, in <module><br>> File "osgeo\__init__.pyc", line 13, in swig_import_helper<br>> File "osgeo\_gdal.pyc", line 12, in <module><br>> File "osgeo\_gdal.pyc", line 10, in __load<br>> ImportError: DLL load failed: The specified module could not be found.<br>> <br>> I have found several references to the same problem but no definitive<br>> solution. Most comments refer to the correct installation of GDAL - but<br>> the whole point is to distribute everything that is needed from GDAL in<br>> the packaged installation file.<br><br>As far as I know when you run the GDAL Python Extension that does not copy the gdalNN.dll into your Python installation and py2exe can only package what is in there.<br><br>> <br>> I have used dependency walker to check what _gdal.pyd (or<br>> osgeo._gdal.pyd, which is produced by py2exe) require and have put<br>> missing dll's into the system32 folder, but that didn't help either. I<br>> just can't figure out what<br>> File "osgeo\_gdal.pyc", line 10, in __load<br>> tries to load.<br><br>6 years ago I did something like you are trying to do. But I don't works
with that same environment anymore so I can't reproduce that process. <br><br>But I
think you should cover the basic first. Like, for example, before running py2exe,
can your scripts run in both machines, your and the target machine?<br><br>If that is true, it is because the folder where gdalNN.dll is installed is
on your PATH environment variable. If not you might need to fix that. I would prefer changing the PATH instead of copying stuff to the system32 folder. But that is just me.<br><br>Would be possible to copy gdalNN.dll to some folder inside the Python installation, so that py2exe can put that into your deployment? I don't know but that could be worth trying.<br><br>Good luck.<br><br>> <br>> Armin<br>> <br>> -- <br>> __________________________________________________________________<br>> Dr. Armin Schmidt<br>> Director, GeodataWIZ Ltd: Geo Data + Visualisation<br>> www.GeodataWIZ.com<br>> www.GeodataWIZ.com/armin-schmidt<br>> Chairman, Internat. Society for Archaeological Prospection<br>> www.archprospection.org<br>> Postdoctoral Researcher, University of Groningen<br>> Groningen Institute of Archaeology<br>> Honorary Visiting Research Fellow, University of Bradford<br>> Department of Archaeological Sciences<br>> Honorary Fellow, Durham University, Department of Archaeology<br>> http://orcid.org/0000-0002-4241-5381<br>> <br>> Email: Armin.R.Schmidt@Gmail.com<br>> <br>> Now available:<br>> Earth Resistance for Archaeologists (2013). Lanham: AltaMira Press<br>> Geophysical Data in Archaeology (2013). Oxford: Oxbow Books.<br>> http://www.amazon.co.uk/-/e/B0034QC4OW<br>> __________________________________________________________________<br>> _______________________________________________<br>> gdal-dev mailing list<br>> gdal-dev@lists.osgeo.org<br>> http://lists.osgeo.org/mailman/listinfo/gdal-dev<br></div> </div></body>
</html>