##// END OF EJS Templates
add nbconvert config file when creating profiles
MinRK -
Show More
@@ -11,7 +11,7 b' Authors:'
11 """
11 """
12
12
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 # Copyright (C) 2008-2011 The IPython Development Team
14 # Copyright (C) 2008 The IPython Development Team
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
@@ -28,6 +28,7 b' from IPython.core.application import ('
28 BaseIPythonApplication, base_flags
28 BaseIPythonApplication, base_flags
29 )
29 )
30 from IPython.core.profiledir import ProfileDir
30 from IPython.core.profiledir import ProfileDir
31 from IPython.utils.importstring import import_item
31 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
32 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
32 from IPython.utils.traitlets import Unicode, Bool, Dict
33 from IPython.utils.traitlets import Unicode, Bool, Dict
33
34
@@ -234,31 +235,32 b' class ProfileCreate(BaseIPythonApplication):'
234 flags = Dict(create_flags)
235 flags = Dict(create_flags)
235
236
236 classes = [ProfileDir]
237 classes = [ProfileDir]
238
239 def _import_app(self, app_path):
240 """import an app class"""
241 app = None
242 name = app_path.rsplit('.', 1)[-1]
243 try:
244 app = import_item(app_path)
245 except ImportError as e:
246 self.log.info("Couldn't import %s, config file will be excluded", name)
247 except Exception:
248 self.log.warn('Unexpected error importing %s', name, exc_info=True)
249 return app
237
250
238 def init_config_files(self):
251 def init_config_files(self):
239 super(ProfileCreate, self).init_config_files()
252 super(ProfileCreate, self).init_config_files()
240 # use local imports, since these classes may import from here
253 # use local imports, since these classes may import from here
241 from IPython.terminal.ipapp import TerminalIPythonApp
254 from IPython.terminal.ipapp import TerminalIPythonApp
242 apps = [TerminalIPythonApp]
255 apps = [TerminalIPythonApp]
243 try:
256 for app_path in (
244 from IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp
257 'IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp',
245 except Exception:
258 'IPython.html.notebookapp.NotebookApp',
246 # this should be ImportError, but under weird circumstances
259 'IPython.nbconvert.nbconvertapp.NbConvertApp',
247 # this might be an AttributeError, or possibly others
260 ):
248 # in any case, nothing should cause the profile creation to crash.
261 app = self._import_app(app_path)
249 pass
262 if app is not None:
250 else:
263 apps.append(app)
251 apps.append(IPythonQtConsoleApp)
252 try:
253 from IPython.html.notebookapp import NotebookApp
254 except ImportError:
255 pass
256 except Exception:
257 self.log.debug('Unexpected error when importing NotebookApp',
258 exc_info=True
259 )
260 else:
261 apps.append(NotebookApp)
262 if self.parallel:
264 if self.parallel:
263 from IPython.parallel.apps.ipcontrollerapp import IPControllerApp
265 from IPython.parallel.apps.ipcontrollerapp import IPControllerApp
264 from IPython.parallel.apps.ipengineapp import IPEngineApp
266 from IPython.parallel.apps.ipengineapp import IPEngineApp
General Comments 0
You need to be logged in to leave comments. Login now