<div class="gmail_quote">2009/9/14 wsh <span dir="ltr">&lt;<a href="mailto:shuhao.w@gmail.com">shuhao.w@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi, all<br>
<br>
When I&#39;m testing a package, some code is broken and I get the error<br>
message &quot;AttributeError: &#39;module&#39; object has no attribute<br>
&#39;interfaces&#39;&quot;.<br>
<br>
After I checked the code I found that there are some code in the<br>
__init__.py like following:<br>
<br>
   &gt;&gt;&gt; from zope.app import container<br>
<br>
When it try to reference the interfaces attribute of the container<br>
module, but the attribute does not exist. I checked the container with<br>
print dir(container) and get following:<br>
<br>
   [&#39;__builtins__&#39;, &#39;__doc__&#39;, &#39;__file__&#39;, &#39;__name__&#39;, &#39;__path__&#39;]<br>
<br>
<br>
But if I add following line in the __init__.py this problem can be<br>
solved.<br>
<br>
    &gt;&gt;&gt; from zope.app import container<br>
    &gt;&gt;&gt; import zope.app.container.constraints<br>
    &gt;&gt;&gt; print dir(container)<br>
    [&#39;__builtins__&#39;, &#39;__doc__&#39;, &#39;__file__&#39;, &#39;__name__&#39;, &#39;__path__&#39;,<br>
&#39;constraints&#39;, &#39;i18n&#39;, &#39;interfaces&#39;]<br>
<br>
<br>
<br>
Can anyone explain this?<br></blockquote><div><br>That&#39;s because zope.app.container.interfaces module is not imported, so zope.app.container doesn&#39;t have &quot;interfaces&quot; attribute. But it seems to be imported by &quot;constraints&quot; module, so it magically appears as &quot;interfaces&quot; in zope.app.container.<br>

 </div></div><br>-- <br>WBR, Dan Korostelev<br>