In article 
<cacgdh2hh5cvykbbca+xf3+vkg_hvzbg8mqe7qaiti3ukxwv...@mail.gmail.com>,
 Paul Wiseman <poal...@gmail.com> wrote:

> On 1 December 2014 at 23:57, Ned Deily <n...@acm.org> wrote:
> 
> > [duplicate reply as the first seems to have disappeared]
> >
> > In article
> > <cacgdh2hoqfsdrfdpblnheeppowquoqskf_bgdovga7+z05e...@mail.gmail.com>,
> >  Paul Wiseman <poal...@gmail.com> wrote:
> > > I don't think it's either of those. I think that hashlib.py must have
> > > changed in 2.7.9 from 2.7.8 (no longer has
> > _hashlib.openssl_md_meth_names) so
> > > the built app (running 2.7.8) expected that attribute to be there, but
> > > somehow py2app or my usage of it is causing it to look in the system
> > > libraries over the frozen libraries. Installing 2.7.8 again hides the
> > issue
> > > because whichever hashlib it uses would have the same behaviour because
> > > they'll be identical (both from v2.7.8)
> > > > In any case, a fresh install seems to have solved the problem.
> > > > On Dec 1, 2014, at 7:29 AM, Paul Wiseman <poal...@gmail.com> wrote:
> > > > I have a frozen app installed (built on a different machine using
> > python
> > > > 2.7.8 32/ppc)
> > > >
> > > > I Installed python 2.7.9rc1 (32/pcc python.org installer) and I
> > started
> > > > seeing errors from the built app on startup
> > > >
> > > > the error occurred from import hashlib
> > > >
> > > >   File
> > > >
> > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py"
> > > > ,
> > > > line 138, in <module>
> > > >     _hashlib.openssl_md_meth_names)
> > > > AttributeError: 'module' object has no attribute
> > 'openssl_md_meth_names'
> > > >
> > > > Installing 2.7.8 again on this machine, and the frozen app started
> > working
> > > > again with no other changes.
> > > >
> > > > Is this a problem with my setup or an issue with the freezing process?
> >
> > The whole point of using py2app in normal, non-alias mode is to provide
> > a self-contained, standalone app not dependent on any external
> > Python-provided infrastructure, e.g. py files or extension modules or
> > shared libs so something is wrong here.  The 'openssl_md_meth_names' was
> > added to _hashlib.so for 2.7.9 (along with a lot of other changes to
> > support the backport of upgraded ssl functionality from Python 3) so
> > what appears to be happening here is that something in your app is
> > incorrectly importing hashlib.py from the 2.7.9 installation in
> > /Library/Frameworks along with (correctly) importing _hashlib.so from
> > your py2app-produced app bundle.
> 
> 
> Yea I think you're right- I'm pretty sure that's what it must be
> 
> 
> > I'm no expert on py2app but I did
> > verify that a very simple app that used hashlib and was built with a
> > current py2app and 2.7.8 did, in fact, work correctly when run in the
> > presence of 2.7.9rc1.  So the question is what is going on with your
> > app.  Questions that come to mind: (1) What is the full traceback (e.g.
> > which file causes hashlib to be imported)?  (2) What is the value of
> > sys.path at that point?  (3) What third-party modules are installed in
> > the app and were any installed after using py2app?
> >
> >
> This is the full traceback:
> 
> Traceback (most recent call last):
>   File "/Applications/Utility.app/Contents/Resources/__boot__.py", line
> 316, in <module>
>     _run()
>   File "/Applications/Utility.app/Contents/Resources/__boot__.py", line
> 311, in _run
>     exec(compile(source, path, 'exec'), globals(), globals())
>   File "/Applications/Utility.app/Contents/Resources/context_main.py", line
> 3, in <module>
>     from PythonApp.context.context import main
>   File "PythonApp/context/context.pyc", line 3, in <module>  # from
> PythonApp.redirectstd import redirect
>   File "PythonApp/redirectstd.pyc", line 5, in <module>  # from PythonApp
> import settings
>   File "PythonApp/settings.pyc", line 7, in <module>  # import hashlib
>   File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py",
> line 138, in <module>
>     _hashlib.openssl_md_meth_names)
> AttributeError: 'module' object has no attribute 'openssl_md_meth_names'
> 2014-12-01 23:44:57.204 Utility[72506:4648486] Utility Error
> 
> I printed out sys.path right before the import hashlib,
> ['/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-
> scriptpackages',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
> '/Applications/Utility.app/Contents/Resources/lib/python2.7/lib-dynload',
> '/Applications/Utility.app/Contents/Resources/lib/python2.7/site-packages.zip'
> ,
> '/Applications/Utility.app/Contents/Resources/lib/python2.7/site-packages']
> 
> There's no modifications in the code to sys.path or the pythonpath (I do
> have modifications to PYTHONPATH in my .bash_profile- but those aren't
> showing up in the sys.path output here, and I'm pretty sure that shouldn't
> affect it right?)

That sys.path certainly looks wrong.  There shouldn't be any 
/Library/Frameworks paths when running in the app.  Yeah, your shell 
profile shouldn't enter into it when running a launched app.  You could 
also check the values for sys.executable, sys.prefix, and 
sys.exec_prefix.
 
> There's quite a lot of 3rd party modules, non of which will have been
> installed after the app was built. hashlib is imported pretty early, before
> any 3rd party imports if that makes a difference.
> 
> I think I'll see tomorrow if I can't make a small sample app and setup.py
> with py2app which I can reproduce the problem and I'll post it up on here.

Sounds like a good idea.  Of course, make sure you have the latest 
version of py2app and its dependencies, too.  Good luck!

-- 
 Ned Deily,
 n...@acm.org

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to