Search code examples
pythonzopeimporterrorgrokzcml

python ImportError: No module named resource in fanstatic configure.zcml in grok-based project


  File "/root/.buildout/eggs/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/srv/csw/parts/etc/site.zcml", line 4.2-4.27
    ZopeXMLConfigurationError: File "/../src/../configure.zcml", line 4.2-4.37
    ZopeXMLConfigurationError: File "/root/.buildout/eggs/grokui.admin-0.9-py2.7.egg/grokui/admin/configure.zcml", line 4.2-4.35
    ZopeXMLConfigurationError: File "/root/.buildout/eggs/grokui.base-0.5.1-py2.7.egg/grokui/base/configure.zcml", line 7.2-7.38
    ZopeXMLConfigurationError: File "/root/.buildout/eggs/zope.fanstatic-0.9.1-py2.7.egg/zope/fanstatic/configure.zcml", line 9.2-9.27
    ImportError: No module named resource

previously all was working fine. I made a few code changes, uploaded to server and started up my python paster instance to test. But the above stack trace occurred on startup and I haven't changed anything in setup.py or other config files for resource.py (essentially a cfg file telling the fanstatic package where static web resources such as images are) to suddenly disappear from the runtime. I have checked & double checked the source, resource.py and all other python files are where they should be.

I've ran buildout again to ensure something wasn't deleted accidentally but still getting the same error above.

Any idea why fanstatic would stop finding resource.py in a grok-based project?


Solution

  • My upload script added an __init__.py to the top-level package directory thus grok was looking in this directory and not the appropriate module subdirectory for resource.py.