On Wed, Nov 26, 2008 at 12:02 PM, Chris Barker wrote:
> I'm having trouble with Paste, pkg_resources and py2exe. The fix I
> developed for py2app is not working.
>
> I'm sure I can come up with some kind of work around, but I'm
> wondering if it really would make more sense to figure out a way to
> turn it off in Paste for deployed apps. Do you know enough about
> how/why Paste is using it to have thoughts about that?

Here's the original traceback:

===
Traceback (most recent call last):
  File "cameo_gui.py", line 7, in <module>
  File "cameo\scripts\standalone2.pyo", line 27, in <module>
  File "cameo\config\middleware.pyo", line 7, in <module>
  File "pylons\__init__.pyo", line 4, in <module>
  File "pylons\config.pyo", line 2, in <module>
  File "pylons\configuration.pyo", line 24, in <module>
  File "pylons\legacy.pyo", line 11, in <module>
  File "pylons\util.pyo", line 18, in <module>
  File "paste\script\appinstall.pyo", line 16, in <module>
  File "paste\script\command.pyo", line 31, in <module>
  File "pkg_resources.pyo", line 270, in get_distribution
  File "pkg_resources.pyo", line 156, in get_provider
  File "pkg_resources.pyo", line 626, in require
  File "pkg_resources.pyo", line 524, in resolve
pkg_resources.DistributionNotFound: PasteScript
===

So pylons.configuration is importing pylons.legacy to support its
deprecation messages.  That imports pylons.util, which imports
paste.script.appinstall, which imports paste.script command.  That
calls ``pkg_resources.get_distribution("PasteScript")`` to determine
its own version number for the "paster" usage message -- which we
aren't using at all.

We commented out pylons.configuration line 14 ("import
pylons.legacy"), which got us past that point.  (That would raise
NameError if any of the deprecations were triggered, but that was not
an issue in our case.)

Then it gave an error:

===
C>python cameo\scripts\standalone2.py standalone.ini
Traceback (most recent call last):
  File "cameo\scripts\standalone2.py", line 27, in <module>
    from cameo.config.middleware import make_app as app_factory
  File "c:\documents and settings\chris.barker\my
documents\hazmat\hazweb\branches\cameo-pylons2\cam
eo\config\middleware.py", line 7, in <module>
    from pylons import config
  File 
"C:\Python25\lib\site-packages\pylons-0.9.7rc2-py2.5.egg\pylons\__init__.py",
line 4, in <mod
ule>
    from pylons.config import config
  File 
"C:\Python25\lib\site-packages\pylons-0.9.7rc2-py2.5.egg\pylons\config.py",
line 2, in <modul
e>
    from pylons.configuration import *
  File 
"C:\Python25\lib\site-packages\pylons-0.9.7rc2-py2.5.egg\pylons\configuration.py",
line 25, i
n <module>
    import pylons.templating
  File 
"C:\Python25\lib\site-packages\pylons-0.9.7rc2-py2.5.egg\pylons\templating.py",
line 653, in
<module>
    (pylons.legacy.render_response_warning, render_response.__doc__)
AttributeError: 'module' object has no attribute 'legacy'
===

This is caused by pylons.templating line 653, which is trying to set a
deprecation docstring:

===
render_response.__doc__ = 'Deprecated:' %s.\n\n%s' % \
    (pylons.legacy.render_response_warning, render_response.__doc__)
===

The module is using pylons.legacy without importing it, so that
clearly needs to be fixed.

After all this we were able to get the wxPython version of the
application to run, but we rebuilt the py2exe version and it still has
the same problem.

There's 54 files total among the Pylons dependencies and SQLAlchemy
that use pkg_resources.  I guess I'll have to go through them one by
one to see how important they are.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to