Hi all,

I'm trying to package a onefile application on a Mac, which uses basemap (a 
toolkit for matplotlib, available in MacPorts). Building the application 
works fine, but running it gives:

IOError: proj data directory not found. Expecting it at: 
<path>/dist/testexe-mac?34496/mpl_toolkits/basemap/data

The pyproj module has an attribute which gives the location of the data 
directory:

>>> import mpl_toolkits.basemap.pyproj
>>> mpl_toolkits.basemap.pyproj.pyproj_datadir
'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mpl_toolkits/basemap/data'

So, I tried to write a hook to tell Pyinstaller about this directory (based 
it on hook-matpotlib.py):

pyinstaller-2.0/PyInstaller/hooks/hook-mpl_toolkits.basemap.pyproj.py:

from PyInstaller.hooks.hookutils import exec_statement

pyproj_data_dir = exec_statement(
    "import mpl_toolkits.basemap.pyproj; print 
mpl_toolkits.basemap.pyproj.pyproj_datadir")

datas = [
    (pyproj_data_dir, ""),
]

I also had to create an empty file 'hook-mpl_toolkits.basemap.py' to avoid 
a RuntimeWarning about a parent module not found. The application builds 
successfully, and the hook is definitely run (tested by adding a print 
statement), however the original error persists. Does anyone have any 
advice about how to fix this? I would be very grateful for any help and 
would be happy to contribute the hook code back once it is working.

Thanks,
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to