##// END OF EJS Templates
delay jinja2 imports to runtime in nbconvert...
MinRK -
Show More
@@ -19,8 +19,8 b' from __future__ import print_function, absolute_import'
19 # Stdlib imports
19 # Stdlib imports
20 import os
20 import os
21
21
22 # other libs/dependencies
22 # other libs/dependencies are imported at runtime
23 from jinja2 import Environment, FileSystemLoader, ChoiceLoader, TemplateNotFound
23 # to move ImportErrors to runtime when the requirement is actually needed
24
24
25 # IPython imports
25 # IPython imports
26 from IPython.utils.traitlets import MetaHasTraits, Unicode, List, Dict, Any
26 from IPython.utils.traitlets import MetaHasTraits, Unicode, List, Dict, Any
@@ -164,6 +164,8 b' class TemplateExporter(Exporter):'
164
164
165 This is triggered by various trait changes that would change the template.
165 This is triggered by various trait changes that would change the template.
166 """
166 """
167 from jinja2 import TemplateNotFound
168
167 if self.template is not None:
169 if self.template is not None:
168 return
170 return
169 # called too early, do nothing
171 # called too early, do nothing
@@ -277,6 +279,7 b' class TemplateExporter(Exporter):'
277 """
279 """
278 Create the Jinja templating environment.
280 Create the Jinja templating environment.
279 """
281 """
282 from jinja2 import Environment, ChoiceLoader, FileSystemLoader
280 here = os.path.dirname(os.path.realpath(__file__))
283 here = os.path.dirname(os.path.realpath(__file__))
281 loaders = []
284 loaders = []
282 if extra_loaders:
285 if extra_loaders:
General Comments 0
You need to be logged in to leave comments. Login now