On Mon, Apr 19, 2010 at 4:05 PM, JohnWShipman <
jo...@nmt.edu> wrote:
> I'm a complete beginner following the steps in _The Definitive Guide
> To Pylons.
> The 'paster create' command worked with no apparent problems. But
> this
> command:
>
> paster serve --reload development.ini
>
> gets a stack traceback that ends like this:
>
> File "/u/john/tcc/mylons/root/lib/python2.6/site-packages/
> PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line
> 561, in get_context object_type, name=name)
> File "/u/john/tcc/mylons/root/lib/python2.6/site-packages/
> PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py", line
> 587, in find_egg_entry_point
> possible.append((entry.load(), protocol,
entry.name))
> File "/u/john/tcc/mylons/root/lib/python2.6/site-packages/
> setuptools-0.6c9-py2.6.egg/pkg_resources.py", line 1913,
> in load
> ImportError: No module named config.middleware
>
> Where do I go from here? There is a file config/middleware.py.
> I haven't touched any file since the 'paster serve'.
Setuptools/pkg_resources is fragile in the sense that the Python path
can get out of whack in several ways and cause an import error. They
are all specific to the particular installation environment, so it can
take some time to track down. It doesn't help that the exception
doesn't say who's asking for it. The 'config.middleware' could be
referring to something in Pylons or Paste.
Does it work without the --reload?
What if you recreate the environment (the virtualenv, if you're using it)?
Did you install the application before running it? ("python setup.py
develop"). I'm not sure if it's strictly necessary, but it will
update the egg-info files, which are what pkg_resources use and can
cause ImportError if they're not up to date.
Which OS and Python version are you using? How did you install Pylons?
Did you create a virtualenv and if so, how? You said you're following
the Pylons book, but I don't remember which approach it uses.
--
Mike Orr <
slugg...@gmail.com>