Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error while building extra_templates #616

Closed
zmousm opened this issue Jun 8, 2015 · 2 comments
Closed

error while building extra_templates #616

zmousm opened this issue Jun 8, 2015 · 2 comments
Labels
Milestone

Comments

@zmousm
Copy link
Contributor

zmousm commented Jun 8, 2015

I am testing mkdocs and I get the following backtrace.

Traceback (most recent call last):
  File "/srv/mkdocs_head/bin/mkdocs", line 9, in <module>
    load_entry_point('mkdocs==0.14.0.dev', 'console_scripts', 'mkdocs')()
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/zmousm/mkdocs/mkdocs/cli.py", line 134, in build_command
    ), clean_site_dir=clean)
  File "/home/zmousm/mkdocs/mkdocs/build.py", line 299, in build
    build_pages(config)
  File "/home/zmousm/mkdocs/mkdocs/build.py", line 252, in build_pages
    build_extra_templates(config['extra_templates'], config, site_navigation)
  File "/home/zmousm/mkdocs/mkdocs/build.py", line 230, in build_extra_templates
    output_content = template.render(context)
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/srv/mkdocs_head/local/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 44, in top-level template code
TypeError: no loader for this environment specified

It appears to be related to extra_templates, even though I am not using any such thing in my config; I have actually removed any theme/theme_dir setting I had in the config and I still get this.

I can see build_extra_templates() was introduced in 26f2465; I can reproduce the same problem in every release after 0.12.2.

I am testing on a Debian wheezy system (python 2.7.3), in a newly created virtualenv where the following modules have been installed:

Jinja2==2.7.3
Markdown==2.6.2
MarkupSafe==0.23
PyYAML==3.11
backports.ssl-match-hostname==3.4.0.2
certifi==2015.04.28
click==4.0
distribute==0.6.24
livereload==2.4.0
-e git+git@github.com:zmousm/mkdocs.git@169e091bd86621dc616b05c8d7200d97cc37d0ac#egg=mkdocs-dev
six==1.9.0
tornado==4.2

Any ideas?

@zmousm
Copy link
Contributor Author

zmousm commented Jun 8, 2015

Well, I found the problem. I had theme_dir pointing to a subdirectory of docs_dir, so mkdocs indeed finds templates, which are there to override theme templates, however. Once I move theme_dir outsidedocs_dir`, the issue goes away.

I don't know if this backtrace should be expected though? The docs don't warn against this.

@d0ugal
Copy link
Member

d0ugal commented Jun 8, 2015

Yup, that's a fair point. I hadn't considered people putting theme_dir's within the docs_dirs. I think maybe we should make extra_templates an opt-in feature only. At the moment MkDocs will try to build any html or XML files it finds in the docs directory.

@d0ugal d0ugal added the Bug label Jun 8, 2015
@d0ugal d0ugal added this to the 0.14.0 milestone Jun 8, 2015
d0ugal added a commit to d0ugal/mkdocs that referenced this issue Jun 8, 2015
This is causing a number of users issues. So, this will now be a opt-in
feature only.

Fixes mkdocs#616
d0ugal added a commit to d0ugal/mkdocs that referenced this issue Jun 8, 2015
This is causing a number of users issues. So, this will now be a opt-in
feature only.

Fixes mkdocs#616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants