I have a python script where I use pyproj as follows:
..
from pyproj import Proj
from pyproj import transform
..
def transformation(extent):
wgs = Proj('''+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs''')
bng = Proj('''+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000
+y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.1502,0.247,
0.8421,-20.4894 +units=m +no_defs''')
extentwgs = []
for xy in extent:
x1, y1 = xy
x2, y2 = transform(bng, wgs, x1, y1)
extentwgs.append((x2, y2))
return extentwgs
I want to make it easily re-distributable on windows running computers. Only site-packages that I'm using are pyproj and simplekml.
I've created a package with py2exe, using default simple setup.py, with no specific settings. This is the error that I get, when I try to run exe file:
C:\temp\dist>Potato2.exe
Traceback (most recent call last):
File "Potato2.py", line 20, in <module>
File "pyproj\__init__.pyc", line 240, in <module>
IOError: proj data directory not found. Expecting it at: C:\temp\dist\library.zip\pyproj\data
I've tried adding data folder (it is actually missing from library.zip) to the archive, but it didn't change anything - same error.
Any ideas?
At first I've written similar script using GDAL bindings but that has proven to be even harder to include in such package. I've redesigned it all but failed again. I would be happy to exchange pyproj to something else, or handle this transformation different way without using site package. Anything to make it work.
Every help will be much appreciated.
Edit: Using PyInstaller gives the same error.
