[Grok-dev] Wierd Thing: Grok Groping All Modules?

Ethan Jucovy ejucovy at gmail.com
Fri Oct 30 08:46:14 EDT 2009


AFAIK the issue has not been solved -- anything you could do to investigate
further or come up with a reproduction recipe would be very helpful.  But I
don't think I'll have any time to get around to looking at this for a couple
of weeks.

It occurs to me that a minimal patch could just wrap the autoinclude
includeableInfo()'s `module = resolve(dotted_name)` with a `try .. except
ImportError`.  That would probably be a good idea no matter what, and I
think would resolve all of the bugs reported in this thread.  But I'd still
like to get to the bottom of this -- autoinclude shouldn't be able to get at
the system-level packages in an isolated environment in the way the OP
described.

Thanks,
Ethan

On Wed, Oct 28, 2009 at 5:15 PM, Graham Stratton <gns24 at mythic-beasts.com>wrote:

>
> On 25 May 2009, at 13:32, Ethan Jucovy wrote:
>
> > On Sun, May 24, 2009 at 10:12 PM, Jeff Rush <jeff at taupro.com> wrote:
> > And it then walked all my packages and gave me an exception
> > traceback when it
> > hit the speechd package.  No idea why it is touching non-Zope
> > packages.
> >
> > Still haven't managed to reproduce this .. it's all very strange to
> > me.
> >
> > Hmm .. could you see what "dist" is, and what `dist.requires()`
> > returns, in your broken setup's zcml.py `autoIncludeDirective`?
> >
> > Here's what z3c.autoinclude is trying to do..
> >
> > 1) `autoIncludeDirective` in zcml.py is invoked by a ZCML directive
> > somewhere.  (grokproject creates the following directive in your new
> > project's configure.zcml: <includeDependencies package="." />)
> > 2) `autoIncludeDirective` takes the package passed in from the ZCML
> > directive, which at this point has already been resolved into a
> > Python module object.
> > 3) `distributionForPackage` takes that module object and determines
> > what distribution (egg) the module was provided by.  This function
> > is really hairy (mostly because of virtual namespace packages) and
> > *does* touch everything in your sys.path but it doesn't look like
> > it's where your problem is coming from.
> > 4) Now autoinclude has a setuptools Distribution object.  It asks
> > that object for the distributions listed in its
> > "install_requires" (that's the `self.context.requires()` line, going
> > through the pkg_resources API -- self.context being the
> > Distribution) and pokes at each of those to find ZCML files to
> > include.
> >
> > So if there's any place where unexpected packages would be touched,
> > I would suspect step #3.  But from the traceback it looks like it's
> > happening in step #4, even though step #4 should only be looping
> > over packages that are explicitly required by your project.
> >
> > You might also try upgrading to z3c.autoinclude v0.3.1.  One
> > significant difference is that v0.2 imports setuptools, which I've
> > heard is a Bad Idea because it triggers some monkeypatching.  Don't
> > know why that would result in this error, though.
>
>
> I also seem to be having this issue. I'm running OSX, not using the
> system Python. The grok instance I'm running has been updated a lot
> since it was created, so probably isn't as clean as it could be, but
> the buildout file it is based on a copy of that produced by the latest
> grokproject.
>
> Has this issue been solved or should I try to investigate further?
>
> The traceback is below. Many thanks,
>
> Graham
>
> 2009-10-29T08:03:00 WARNING root Developer mode is enabled: this is a
> security risk and should NOT be enabled on production servers.
> Developer mode can be turned off in etc/zope.conf
> Traceback (most recent call last):
>  File "./bin/grokstar-debug", line 128, in <module>
>    grokstar.startup.interactive_debug_prompt()
>  File "/Users/graham/development/zopeorggrokstar/src/grokstar/
> startup.py", line 13, in interactive_debug_prompt
>    db = zope.app.wsgi.config(zope_conf)
>  File "/usr/local/lib/python2.5/site-packages/PIL-1.1.6-py2.5-
> macosx-10.3-i386.egg/__init__.py", line 124, in config
>
>  File "/Users/graham/.buildout/eggs/tmpVKUl1q/zope.app.appsetup-3.4.1-
> py2.5.egg/zope/app/appsetup/appsetup.py", line 111, in config
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 610, in file
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 546, in include
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 378, in processxmlfile
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 107, in
> parse
>    xmlreader.IncrementalParser.parse(self, source)
>  File "/usr/local/lib/python2.5/xml/sax/xmlreader.py", line 123, in
> parse
>    self.feed(buffer)
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 207, in
> feed
>    self._parser.Parse(data, isFinal)
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 349, in
> end_element_ns
>    self._cont_handler.endElementNS(pair, None)
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 357, in endElementNS
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/config.py", line
> 542, in end
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/config.py", line
> 690, in finish
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 546, in include
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 378, in processxmlfile
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 107, in
> parse
>    xmlreader.IncrementalParser.parse(self, source)
>  File "/usr/local/lib/python2.5/xml/sax/xmlreader.py", line 123, in
> parse
>    self.feed(buffer)
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 207, in
> feed
>    self._parser.Parse(data, isFinal)
>  File "/usr/local/lib/python2.5/xml/sax/expatreader.py", line 349, in
> end_element_ns
>    self._cont_handler.endElementNS(pair, None)
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/xmlconfig.py",
> line 357, in endElementNS
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/config.py", line
> 542, in end
>  File "/Users/graham/.buildout/eggs/tmpcEOKao/
> zope.configuration-3.4.0-py2.5.egg/zope/configuration/config.py", line
> 690, in finish
>   File "/Users/graham/.buildout/eggs/z3c.autoinclude-0.3.1-py2.5.egg/
> z3c/autoinclude/zcml.py", line 51, in includeDependenciesDirective
>     info = DependencyFinder(dist).includableInfo(['configure.zcml',
> 'meta.zcml'])
>   File "/Users/graham/.buildout/eggs/z3c.autoinclude-0.3.1-py2.5.egg/
> z3c/autoinclude/dependency.py", line 24, in includableInfo
>    module = resolve(dotted_name)
>  File "/Users/graham/.buildout/eggs/tmpe64Jup/zope.dottedname-3.4.2-
> py2.5.egg/zope/dottedname/resolve.py", line 32, in resolve
>   File "/usr/local/lib/python2.5/site-packages/PIL-1.1.6-py2.5-
> macosx-10.3-i386.egg/__init__.py", line 16, in <module>
>
> zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/Users/
> graham/development/zopeorggrokstar/etc/site.zcml", line 4.2-4.32
>    ZopeXMLConfigurationError: File "/Users/graham/development/
> zopeorggrokstar/src/grokstar/configure.zcml", line 4.2-4.37
>    ImportError: No module named wx
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20091030/ba582e57/attachment.html 


More information about the Grok-dev mailing list