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

Ethan Jucovy ejucovy at gmail.com
Fri May 22 13:40:16 EDT 2009


Hmm, I think this is a bug in z3c.autoinclude.  It's importing the
locations to get their file paths so it can look for ZCML files to be
included.  But I *think* it could just as easily use
pkg_resources.resource_filename (which is safe AFAIK) to get those
paths.  I'll try to double check that this change doesn't have any
unintended consequences and put in the fix.

The case you're describing would be a good test, too; I'll try to add it.

(It's not trying to import everything in your site-packages, BTW --
just the things listed as install_requires dependencies in your
setup.py.)

In the meantime, you can turn off z3c.autoinclude's behavior entirely
by removing the <includeDependencies /> directive from your ZCML, but
you'll have to add some <include /> directives manually if you do.

FWIW, one of these days I'd like to add support for a sort of
blacklist of packages that z3c.autoinclude should stay away from
entirely.

Ethan

On Fri, May 22, 2009 at 11:17 AM, Jeff Rush <jeff at taupro.com> wrote:
> Hi, I'm just starting to check out Grok and when I do my first:
>
>  $ bin/python bin/zopectl fg
>
> it gives me a traceback that I've chased down to the z3c.autoinclude package
> trying to import everything in my site-packages.  That is a no-no.  I added
> print stmts and I see:
>
> $ bin/python bin/zopectl fg
>
> /home/jeff/Projects/grokwork/parts/app/runzope -C
>
> /home/jeff/Projects/grokwork/parts/zopectl/zope.conf
>
> JRR: include_candidates are ['configure.zcml', 'meta.zcml']
>
> JRR: dotted_name is 'bb'
>
> JRR: dotted_name is 'PIL'
>
> JRR: dotted_name is 'gsf'
>
> JRR: dotted_name is 'svn'
>
> JRR: dotted_name is 'atom'
>
> JRR: dotted_name is 'dbus'
>
> JRR: dotted_name is 'lxml'
>
> JRR: dotted_name is 'rope'
>
> JRR: dotted_name is 'java_config_2'
>
> JRR: dotted_name is 'Cython'
>
> JRR: dotted_name is 'deskbar'
>
> JRR: dotted_name is 'PyQt4'
>
> JRR: dotted_name is 'Pyrex'
>
> JRR: dotted_name is 'OpenSSL'
>
> JRR: dotted_name is 'antlr'
>
> JRR: dotted_name is 'avahi'
>
> JRR: dotted_name is 'cairo'
>
> JRR: dotted_name is 'gdata'
>
> JRR: dotted_name is 'hgext'
>
> JRR: dotted_name is 'numpy'
>
> JRR: dotted_name is 'psyco'
>
> JRR: dotted_name is 'OpenGL'
>
> JRR: dotted_name is 'speechd_config'
>
>
> and it blows up because the speechd_config module cannot be imported except in
> a special environment.  But then I really don't want it importing all the
> other packages listed here either, for performance, stability and security
> reasons.
>
> Any ideas why this is happening?  Surely it isn't normal.
>
> -Jeff
>
>
>
>  File
> "/var/tmp/buildout/eggs/z3c.autoinclude-0.2.2-py2.5.egg/z3c/autoinclude/zcml.py",
> line 39, in autoIncludeDirective
>    info = DependencyFinder(dist).includableInfo(['configure.zcml', 'meta.zcml'])
>  File
> "/var/tmp/buildout/eggs/z3c.autoinclude-0.2.2-py2.5.egg/z3c/autoinclude/dependency.py",
> line 27, in includableInfo
>    module = resolve(dotted_name)
>  File
> "/var/tmp/buildout/eggs/zope.dottedname-3.4.2-py2.5.egg/zope/dottedname/resolve.py",
> line 32, in resolve
>    found = __import__(used)
>  File "//usr/lib/python2.5/site-packages/speechd_config/__init__.py", line
> 17, in <module>
>    from config import *
>  File "//usr/lib/python2.5/site-packages/speechd_config/config.py", line 28,
> in <module>
>    import paths
> zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
> "/home/jeff/Projects/grokwork/parts/app/site.zcml", line 4.0-4.30
>    ZopeXMLConfigurationError: File
> "/home/jeff/Projects/grokwork/src/grokwork/configure.zcml", line 4.2-4.37
>    ImportError: No module named paths
>
> (module 'paths' is part of speechd and should not be touched by Grok)
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list