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

Ethan Jucovy ejucovy at gmail.com
Sun May 24 23:32:07 EDT 2009


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'd also be curious whether the error goes away if you downgrade to
z3c.autoinclude v0.1, but now I'm probably asking way too much :)

egj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090524/89fb6c11/attachment.html 


More information about the Grok-dev mailing list