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