If I try to use nbconvert with a custom template by either of:
jupyter nbconvert --config=my_config.py --log-level=DEBUG Untitled.ipynb
jupyter nbconvert --template=my_template.tpl --log-level=DEBUG Untitled.ipynb
I can only get it to work if the custom file is in the same directory.
If I use the config route with:
#---
from jupyter_core.paths import jupyter_data_dir
extensiondir=os.path.join(jupyter_data_dir(),'nbextensions/myextension/')
c = get_config()
c.TemplateExporter.template_path = [ extensiondir ]
c.TemplateExporter.template_file = 'my_template.tpl'
#---
I can relocate the template file but the config file needs to be in the local directory.
The debug trace suggests that there re not paths down down which the script looks for the config file?
[NbConvertApp] Config changed:
[NbConvertApp] {'NbConvertApp': {'log_level': 'DEBUG', 'config_file': 'ipython_nbconvert_config2.py'}}
[NbConvertApp] Searching ['/vagrant/notebooks', '/root/.jupyter', '/usr/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[NbConvertApp] Attempting to load config file jupyter_config.py in path /etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.json in path /etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.py in path /usr/local/etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.json in path /usr/local/etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.py in path /usr/etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.json in path /usr/etc/jupyter
[NbConvertApp] Attempting to load config file jupyter_config.py in path /root/.jupyter
[NbConvertApp] Attempting to load config file jupyter_config.json in path /root/.jupyter
[NbConvertApp] Attempting to load config file jupyter_config.py in path /vagrant/notebooks
[NbConvertApp] Attempting to load config file jupyter_config.json in path /vagrant/notebooks
[NbConvertApp] Attempting to load config file ipython_nbconvert_config2.py in path
[NbConvertApp] Attempting to load config file ipython_nbconvert_config2.json in path
[NbConvertApp] Converting notebook Untitled.ipynb to html
That is, the path is empty?
My workaround is to copy the template file into the local dir, run with that, and then delete the local template file. Which I'm sure is not the way to do it properly?!