Andrew,

My guess for the hook file (will probably need tweaking):

from hookutils import collect_data_files


def hook(mod):

    global datas

    datas = collect_data_files('mpl_toolkits.basemap.pyproj')

    return mod




On Mon, Feb 4, 2013 at 9:19 AM, Andy Clegg <[email protected]> wrote:

> 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.
>
>
>



-- 
Bryan A. Jones, Ph.D.
Associate Professor
Department of Electrical and Computer Engineering
231 Simrall / PO Box 9571
Mississippi State University
Mississippi state, MS 39762
http://www.ece.msstate.edu/~bjones
bjones AT ece DOT msstate DOT edu
voice 662-325-3149
fax 662-325-2298

Our Master, Jesus Christ, is on his way. He'll show up right on
time, his arrival guaranteed by the Blessed and Undisputed Ruler,
High King, High God.
- 1 Tim. 6:14b-15 (The Message)

-- 
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