Massimo Di Stefano wrote:
> 
> 
i'm tring for the first time to use py2app :-)
> i need to create a .app
> 
> [snip]
> 
> ImportError: No module named pytz.zoneinfo
>  > /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/ 
> python/modulegraph/modulegraph.py(444)load_tail()
> -> raise ImportError, "No module named " + mname
> (Pdb) q
> 
> i tried to copy a zipped file of my site packages into
> 
> may.app/Contents/Resources/lib/python2.5/
> but without succes :-(
> 
> i installed py2app using easy_install
> on a mac osx 10.5.2

> 

I think your first problem is that you are using the "packages" option in
the setup options dictionary as a catchall. You need to add modules to the
"includes" option and genuine packages to the "packages" options. Python
packages exist as a directory of python files with an "__init__.py" and
modules exist as ".py" files. See the python docs on 
http://docs.python.org/tut/node8.html Modules  for more info.


Your second problem is the fault of the pytz maintainers. Somehow, they
managed to hose backwards compatibility of the pytz module by ridding it of
the "zoneinfo" submodule and pytz.zoneinfo's attribute "UTC". I think they
did this for evil fun because no one would do this out of the blue like that
without thinking of all of the stuff it would break. To fix this, I think
its easiest just to modify the pytz package in the setup.py file by
importing it and modifying its attributes appropriately.


Here, I have fixed both problems in my own setup.py file:


from setuptools import setup

import pytz
pytz.zoneinfo = pytz.tzinfo
pytz.zoneinfo.UTC = pytz.UTC

APPNAME = 'myapp'
APP = ['%s.py' % APPNAME]
DATA_FILES = []
OPTIONS = {'argv_emulation': False,
           'iconfile': "%s.icns" % APPNAME,
           'includes': ['ScAdvancedWidgets', 'configobj'],
           'packages': ['Pmw', 'pyTableLib', 'matplotlib']}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)


Hopefully, if anyone sees any problems with this latter approach, especially
pytz, py2app, or matplotlib people, they will speak up and suggest a better
fix.

-- 
View this message in context: 
http://www.nabble.com/py2app-and-missed-modules-tp17309983p17620597.html
Sent from the Python - pythonmac-sig mailing list archive at Nabble.com.
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to