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 | |
@@ -206,6 +207,8 b' class ProfileCreate(BaseIPythonApplication):' | |||
|
206 | 207 | description = create_help |
|
207 | 208 | examples = _create_examples |
|
208 | 209 | auto_create = Bool(True, config=False) |
|
210 | def _log_format_default(self): | |
|
211 | return "[%(name)s] %(message)s" | |
|
209 | 212 | |
|
210 | 213 | def _copy_config_files_default(self): |
|
211 | 214 | return True |
@@ -235,30 +238,31 b' class ProfileCreate(BaseIPythonApplication):' | |||
|
235 | 238 | |
|
236 | 239 | classes = [ProfileDir] |
|
237 | 240 | |
|
241 | def _import_app(self, app_path): | |
|
242 | """import an app class""" | |
|
243 | app = None | |
|
244 | name = app_path.rsplit('.', 1)[-1] | |
|
245 | try: | |
|
246 | app = import_item(app_path) | |
|
247 | except ImportError as e: | |
|
248 | self.log.info("Couldn't import %s, config file will be excluded", name) | |
|
249 | except Exception: | |
|
250 | self.log.warn('Unexpected error importing %s', name, exc_info=True) | |
|
251 | return app | |
|
252 | ||
|
238 | 253 | def init_config_files(self): |
|
239 | 254 | super(ProfileCreate, self).init_config_files() |
|
240 | 255 | # use local imports, since these classes may import from here |
|
241 | 256 | from IPython.terminal.ipapp import TerminalIPythonApp |
|
242 | 257 | 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) | |
|
258 | for app_path in ( | |
|
259 | 'IPython.qt.console.qtconsoleapp.IPythonQtConsoleApp', | |
|
260 | 'IPython.html.notebookapp.NotebookApp', | |
|
261 | 'IPython.nbconvert.nbconvertapp.NbConvertApp', | |
|
262 | ): | |
|
263 | app = self._import_app(app_path) | |
|
264 | if app is not None: | |
|
265 | apps.append(app) | |
|
262 | 266 | if self.parallel: |
|
263 | 267 | from IPython.parallel.apps.ipcontrollerapp import IPControllerApp |
|
264 | 268 | from IPython.parallel.apps.ipengineapp import IPEngineApp |
General Comments 0
You need to be logged in to leave comments.
Login now