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

Changed documentation of external_exporters #1582

Closed
wants to merge 2 commits into from

Conversation

JimZwartveld
Copy link

The example provided in the documentation required the user to append his/her path to templates to super().template_paths, while super().template_paths is looking for the user provided template name.

Changed documentation such that user updates extra_template_basedirs.

I believe this PR can close Issue #1581

Jim Zwartveld added 2 commits May 27, 2021 13:36
…ters documentation.

- changed _template_file_default (filename of jinja file) to _template_name_default (template folder name).
@JimZwartveld JimZwartveld mentioned this pull request May 27, 2021
@MSeal MSeal added this to the 6.1 milestone Jun 8, 2021
@amichuda
Copy link

amichuda commented Sep 15, 2021

Hi! I'm writing a custom exporter from .ipynb to Stata .do files and I changed the code accordingly, and now I get:

ValueError: No template sub-directory with name 'dofile' found in the following paths:
        /home/<user>/.local/share/jupyter
        /usr/local/share/jupyter
        /usr/share/jupyter

I believe that the issue might lie in:

for base_dir in self.extra_template_basedirs:
template_dir = os.path.join(base_dir, base_template)
if os.path.exists(template_dir):
found_at_least_one = True
conf_file = os.path.join(template_dir, 'conf.json')
if os.path.exists(conf_file):
with open(conf_file) as f:
conf = recursive_update(json.load(f), conf)

where found_at_least_one is never flagged as True because there's a path check, and it's not checked with its extension. Could that be the case.

In any case, if that check goes through by changing template_dir to template_dir + ".tpl", I get this weird error now

...
  File "/usr/lib/python3.9/site-packages/jinja2/loaders.py", line 556, in load
    raise TemplateNotFound(name)
jinja2.exceptions.TemplateNotFound: index.<extension>.j2

Is this a bug or there's something wrong with my understanding?

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

Successfully merging this pull request may close these issues.

3 participants