On Sun, May 24, 2009 at 10:12 PM, Jeff Rush <span dir="ltr">&lt;<a href="mailto:jeff@taupro.com">jeff@taupro.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

And it then walked all my packages and gave me an exception traceback when it<br>
hit the speechd package.  No idea why it is touching non-Zope packages.<br>
<font color="#888888"></font></blockquote><div><br>Still haven&#39;t managed to reproduce this .. it&#39;s all very strange to me.<br><br>Hmm .. could you see what &quot;dist&quot; is, and what `dist.requires()` returns, in your broken setup&#39;s zcml.py `autoIncludeDirective`?<br>


<br>Here&#39;s what z3c.autoinclude is trying to do..<br><br>1) `autoIncludeDirective` in zcml.py is invoked by a ZCML directive somewhere.  (grokproject creates the following directive in your new project&#39;s configure.zcml: &lt;includeDependencies package=&quot;.&quot; /&gt;)<br>

2) `autoIncludeDirective` takes the package passed in from the ZCML directive, which at this point has already been resolved into a Python module object.<br>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&#39;t look like it&#39;s where your problem is coming from.<br>

4) Now autoinclude has a setuptools Distribution object.  It asks that object for the distributions listed in its &quot;install_requires&quot; (that&#39;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.<br>

<br>So if there&#39;s any place where unexpected packages would be touched, I would suspect step #3.  But from the traceback it looks like it&#39;s happening in step #4, even though step #4 should only be looping over packages that are explicitly required by your project.<br>

<br>You might also try upgrading to z3c.autoinclude v0.3.1.  One significant difference is that v0.2 imports setuptools, which I&#39;ve heard is a Bad Idea because it triggers some monkeypatching.  Don&#39;t know why that would result in this error, though.<br>

<br>I&#39;d also be curious whether the error goes away if you downgrade to z3c.autoinclude v0.1, but now I&#39;m probably asking way too much :)<br><br>egj<br></div></div>