nice error for missing

Skip to first unread message

Nov 27, 2022, 5:50:33 AM11/27/22
to pylons-discuss
Upon upgrading to 2.0 I just removed my empty files or at least I tried to (hoping I won't need them any more).

Eventually I realised I had to put some of them back as config.scan() broke without them.

My recommendation is that if possible, can you make a better error message for this? Because I basically got a 73 line long stack trace, which contained absolutely no information about what is the problem. I mean, just as a nice to have, for other users who happen run into this very long stacktrace.

2022-11-27 11:44:39,679 ERROR [waitress] Exception while serving /
Traceback (most recent call last):
  File "python3.10/site-packages/waitress/", line 428, in service
  File "python3.10/site-packages/waitress/", line 168, in service
  File "python3.10/site-packages/waitress/", line 434, in execute
    app_iter =, start_response)
  File "python3.10/site-packages/pyramid/", line 270, in __call__
    response = self.execution_policy(environ, self)
  File "python3.10/site-packages/pyramid/", line 276, in default_execution_policy
    return router.invoke_request(request)
  File "python3.10/site-packages/pyramid/", line 245, in invoke_request
    response = handle_request(request)
  File "python3.10/site-packages/pyramid_tm/", line 178, in tm_tween
    raise exc from None
  File "python3.10/site-packages/pyramid_tm/", line 145, in tm_tween
    response = handler(request)
  File "python3.10/site-packages/pyramid/", line 43, in excview_tween
    response = _error_handler(request, exc)
  File "python3.10/site-packages/pyramid/", line 17, in _error_handler
  File "python3.10/site-packages/pyramid/", line 733, in reraise
    raise value
  File "python3.10/site-packages/pyramid/", line 41, in excview_tween
    response = handler(request)
  File "python3.10/site-packages/pyramid/", line 143, in handle_request
    response = _call_view(
  File "python3.10/site-packages/pyramid/", line 674, in _call_view
    response = view_callable(context, request)
  File "python3.10/site-packages/pyramid/", line 512, in csrf_view
    return view(context, request)
  File "md_server/", line 30, in wrapper_view
    response = view(context, request)
  File "md_server/", line 43, in wrapper_view
    response = view(context, request)
  File "md_server/", line 65, in wrapper_view
    response = view(context, request)
  File "md_server/", line 142, in wrapper_view
    response = view(context, request)
  File "python3.10/site-packages/pyramid/", line 450, in rendered_view
    response = view_renderer.render_view(
  File "python3.10/site-packages/pyramid/", line 443, in render_view
    return self.render_to_response(response, system, request=request)
  File "python3.10/site-packages/pyramid/", line 466, in render_to_response
    result = self.render(value, system_values, request=request)
  File "python3.10/site-packages/pyramid/", line 462, in render
    result = renderer(value, system_values)
  File "python3.10/site-packages/pyramid_jinja2/", line 260, in __call__
    template = self.template_loader()
  File "python3.10/site-packages/pyramid_jinja2/", line 275, in template_loader
    return self.environment.get_template(name_with_package)
  File "python3.10/site-packages/jinja2/", line 1010, in get_template
    return self._load_template(name, globals)
  File "python3.10/site-packages/jinja2/", line 969, in _load_template
    template = self.loader.load(self, name, self.make_globals(globals))
  File "python3.10/site-packages/jinja2/", line 126, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "python3.10/site-packages/pyramid_jinja2/", line 197, in get_source
    src = self._get_absolute_source(template)
  File "python3.10/site-packages/pyramid_jinja2/", line 137, in _get_absolute_source
    filename = abspath_from_asset_spec(template)
  File "python3.10/site-packages/pyramid/", line 43, in abspath_from_asset_spec
    return pkg_resources.resource_filename(pname, filename)
  File "python3.10/site-packages/pkg_resources/", line 1154, in resource_filename
    return get_provider(package_or_requirement).get_resource_filename(
  File "python3.10/site-packages/pkg_resources/", line 361, in get_provider
    return _find_adapter(_provider_factories, loader)(module)
  File "python3.10/site-packages/pkg_resources/", line 1403, in __init__
    self.module_path = os.path.dirname(getattr(module, '__file__', ''))
  File "/Users/user/.pyenv/versions/3.10.8/lib/python3.10/", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType


Bert JW Regeer

Nov 27, 2022, 2:13:41 PM11/27/22
The stack trace you just posted is related to Jinja2 and attempts to use pkg_resources (in fact it is failing inside pkg_resources) not config.scan()…

As for the venusian issue (and related pkg_resources issues) of not being able to scan folders without see

> --
> You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> To view this discussion on the web visit

Reply all
Reply to author
0 new messages