Pylons/pyramid — Issue #420: Vague error message when config asset spec points to missing file
Author: mikeorr
Created: 2012-01-25 06:39:44+00:00
State: open

I had `config.include(".pony")` in an application, which worked fine when the module existed, but when I moved the module to another location and forgot to change the asset spec, it said:

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/sluggo/exp/Akhet/akhet/demo/__main__.py", line 31, in
if __name__ == "__main__": serve()
File "/home/sluggo/exp/Akhet/akhet/demo/__main__.py", line 26, in serve
app = akhet.demo.main({}, **settings)
File "akhet/demo/__init__.py", line 21, in main
config.include(".pony")
File "/home/sluggo/exp/Pyramid/pyramid/config/__init__.py", line 718, in include
configurator.basepath = os.path.dirname(sourcefile)
File "/home/sluggo/.virtualenvs/pyr2/lib/python2.7/posixpath.py", line 120, in dirname
i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

It should say something like, "ValueError: the asset referenced by '.pony' does not exist"