##// END OF EJS Templates
Use @catch_config_error to catch exception from getcwdu in nonexisting directory
Thomas Spura -
Show More
@@ -1,342 +1,343 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """
2 """
3 An application for IPython.
3 An application for IPython.
4
4
5 All top-level applications should use the classes in this module for
5 All top-level applications should use the classes in this module for
6 handling configuration and creating componenets.
6 handling configuration and creating componenets.
7
7
8 The job of an :class:`Application` is to create the master configuration
8 The job of an :class:`Application` is to create the master configuration
9 object and then create the configurable objects, passing the config to them.
9 object and then create the configurable objects, passing the config to them.
10
10
11 Authors:
11 Authors:
12
12
13 * Brian Granger
13 * Brian Granger
14 * Fernando Perez
14 * Fernando Perez
15 * Min RK
15 * Min RK
16
16
17 """
17 """
18
18
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20 # Copyright (C) 2008-2011 The IPython Development Team
20 # Copyright (C) 2008-2011 The IPython Development Team
21 #
21 #
22 # Distributed under the terms of the BSD License. The full license is in
22 # Distributed under the terms of the BSD License. The full license is in
23 # the file COPYING, distributed as part of this software.
23 # the file COPYING, distributed as part of this software.
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
25
25
26 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
27 # Imports
27 # Imports
28 #-----------------------------------------------------------------------------
28 #-----------------------------------------------------------------------------
29
29
30 import atexit
30 import atexit
31 import glob
31 import glob
32 import logging
32 import logging
33 import os
33 import os
34 import shutil
34 import shutil
35 import sys
35 import sys
36
36
37 from IPython.config.application import Application, catch_config_error
37 from IPython.config.application import Application, catch_config_error
38 from IPython.config.loader import ConfigFileNotFound
38 from IPython.config.loader import ConfigFileNotFound
39 from IPython.core import release, crashhandler
39 from IPython.core import release, crashhandler
40 from IPython.core.profiledir import ProfileDir, ProfileDirError
40 from IPython.core.profiledir import ProfileDir, ProfileDirError
41 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
41 from IPython.utils.path import get_ipython_dir, get_ipython_package_dir
42 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict
42 from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict
43
43
44 #-----------------------------------------------------------------------------
44 #-----------------------------------------------------------------------------
45 # Classes and functions
45 # Classes and functions
46 #-----------------------------------------------------------------------------
46 #-----------------------------------------------------------------------------
47
47
48
48
49 #-----------------------------------------------------------------------------
49 #-----------------------------------------------------------------------------
50 # Base Application Class
50 # Base Application Class
51 #-----------------------------------------------------------------------------
51 #-----------------------------------------------------------------------------
52
52
53 # aliases and flags
53 # aliases and flags
54
54
55 base_aliases = {
55 base_aliases = {
56 'profile' : 'BaseIPythonApplication.profile',
56 'profile' : 'BaseIPythonApplication.profile',
57 'ipython-dir' : 'BaseIPythonApplication.ipython_dir',
57 'ipython-dir' : 'BaseIPythonApplication.ipython_dir',
58 'log-level' : 'Application.log_level',
58 'log-level' : 'Application.log_level',
59 }
59 }
60
60
61 base_flags = dict(
61 base_flags = dict(
62 debug = ({'Application' : {'log_level' : logging.DEBUG}},
62 debug = ({'Application' : {'log_level' : logging.DEBUG}},
63 "set log level to logging.DEBUG (maximize logging output)"),
63 "set log level to logging.DEBUG (maximize logging output)"),
64 quiet = ({'Application' : {'log_level' : logging.CRITICAL}},
64 quiet = ({'Application' : {'log_level' : logging.CRITICAL}},
65 "set log level to logging.CRITICAL (minimize logging output)"),
65 "set log level to logging.CRITICAL (minimize logging output)"),
66 init = ({'BaseIPythonApplication' : {
66 init = ({'BaseIPythonApplication' : {
67 'copy_config_files' : True,
67 'copy_config_files' : True,
68 'auto_create' : True}
68 'auto_create' : True}
69 }, """Initialize profile with default config files. This is equivalent
69 }, """Initialize profile with default config files. This is equivalent
70 to running `ipython profile create <profile>` prior to startup.
70 to running `ipython profile create <profile>` prior to startup.
71 """)
71 """)
72 )
72 )
73
73
74
74
75 class BaseIPythonApplication(Application):
75 class BaseIPythonApplication(Application):
76
76
77 name = Unicode(u'ipython')
77 name = Unicode(u'ipython')
78 description = Unicode(u'IPython: an enhanced interactive Python shell.')
78 description = Unicode(u'IPython: an enhanced interactive Python shell.')
79 version = Unicode(release.version)
79 version = Unicode(release.version)
80
80
81 aliases = Dict(base_aliases)
81 aliases = Dict(base_aliases)
82 flags = Dict(base_flags)
82 flags = Dict(base_flags)
83 classes = List([ProfileDir])
83 classes = List([ProfileDir])
84
84
85 # Track whether the config_file has changed,
85 # Track whether the config_file has changed,
86 # because some logic happens only if we aren't using the default.
86 # because some logic happens only if we aren't using the default.
87 config_file_specified = Bool(False)
87 config_file_specified = Bool(False)
88
88
89 config_file_name = Unicode(u'ipython_config.py')
89 config_file_name = Unicode(u'ipython_config.py')
90 def _config_file_name_default(self):
90 def _config_file_name_default(self):
91 return self.name.replace('-','_') + u'_config.py'
91 return self.name.replace('-','_') + u'_config.py'
92 def _config_file_name_changed(self, name, old, new):
92 def _config_file_name_changed(self, name, old, new):
93 if new != old:
93 if new != old:
94 self.config_file_specified = True
94 self.config_file_specified = True
95
95
96 # The directory that contains IPython's builtin profiles.
96 # The directory that contains IPython's builtin profiles.
97 builtin_profile_dir = Unicode(
97 builtin_profile_dir = Unicode(
98 os.path.join(get_ipython_package_dir(), u'config', u'profile', u'default')
98 os.path.join(get_ipython_package_dir(), u'config', u'profile', u'default')
99 )
99 )
100
100
101 config_file_paths = List(Unicode)
101 config_file_paths = List(Unicode)
102 def _config_file_paths_default(self):
102 def _config_file_paths_default(self):
103 return [os.getcwdu()]
103 return [os.getcwdu()]
104
104
105 profile = Unicode(u'default', config=True,
105 profile = Unicode(u'default', config=True,
106 help="""The IPython profile to use."""
106 help="""The IPython profile to use."""
107 )
107 )
108
108
109 def _profile_changed(self, name, old, new):
109 def _profile_changed(self, name, old, new):
110 self.builtin_profile_dir = os.path.join(
110 self.builtin_profile_dir = os.path.join(
111 get_ipython_package_dir(), u'config', u'profile', new
111 get_ipython_package_dir(), u'config', u'profile', new
112 )
112 )
113
113
114 ipython_dir = Unicode(get_ipython_dir(), config=True,
114 ipython_dir = Unicode(get_ipython_dir(), config=True,
115 help="""
115 help="""
116 The name of the IPython directory. This directory is used for logging
116 The name of the IPython directory. This directory is used for logging
117 configuration (through profiles), history storage, etc. The default
117 configuration (through profiles), history storage, etc. The default
118 is usually $HOME/.ipython. This options can also be specified through
118 is usually $HOME/.ipython. This options can also be specified through
119 the environment variable IPYTHONDIR.
119 the environment variable IPYTHONDIR.
120 """
120 """
121 )
121 )
122
122
123 overwrite = Bool(False, config=True,
123 overwrite = Bool(False, config=True,
124 help="""Whether to overwrite existing config files when copying""")
124 help="""Whether to overwrite existing config files when copying""")
125 auto_create = Bool(False, config=True,
125 auto_create = Bool(False, config=True,
126 help="""Whether to create profile dir if it doesn't exist""")
126 help="""Whether to create profile dir if it doesn't exist""")
127
127
128 config_files = List(Unicode)
128 config_files = List(Unicode)
129 def _config_files_default(self):
129 def _config_files_default(self):
130 return [u'ipython_config.py']
130 return [u'ipython_config.py']
131
131
132 copy_config_files = Bool(False, config=True,
132 copy_config_files = Bool(False, config=True,
133 help="""Whether to install the default config files into the profile dir.
133 help="""Whether to install the default config files into the profile dir.
134 If a new profile is being created, and IPython contains config files for that
134 If a new profile is being created, and IPython contains config files for that
135 profile, then they will be staged into the new directory. Otherwise,
135 profile, then they will be staged into the new directory. Otherwise,
136 default config files will be automatically generated.
136 default config files will be automatically generated.
137 """)
137 """)
138
138
139 verbose_crash = Bool(False, config=True,
139 verbose_crash = Bool(False, config=True,
140 help="""Create a massive crash report when IPython encounters what may be an
140 help="""Create a massive crash report when IPython encounters what may be an
141 internal error. The default is to append a short message to the
141 internal error. The default is to append a short message to the
142 usual traceback""")
142 usual traceback""")
143
143
144 # The class to use as the crash handler.
144 # The class to use as the crash handler.
145 crash_handler_class = Type(crashhandler.CrashHandler)
145 crash_handler_class = Type(crashhandler.CrashHandler)
146
146
147 @catch_config_error
147 def __init__(self, **kwargs):
148 def __init__(self, **kwargs):
148 super(BaseIPythonApplication, self).__init__(**kwargs)
149 super(BaseIPythonApplication, self).__init__(**kwargs)
149 # ensure current working directory exists
150 # ensure current working directory exists
150 try:
151 try:
151 directory = os.getcwdu()
152 directory = os.getcwdu()
152 except:
153 except:
153 # raise exception
154 # raise exception
154 self.log.error("Current working directory doesn't exist.")
155 self.log.error("Current working directory doesn't exist.")
155 raise
156 raise
156
157
157 # ensure even default IPYTHONDIR exists
158 # ensure even default IPYTHONDIR exists
158 if not os.path.exists(self.ipython_dir):
159 if not os.path.exists(self.ipython_dir):
159 self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir)
160 self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir)
160
161
161 #-------------------------------------------------------------------------
162 #-------------------------------------------------------------------------
162 # Various stages of Application creation
163 # Various stages of Application creation
163 #-------------------------------------------------------------------------
164 #-------------------------------------------------------------------------
164
165
165 def init_crash_handler(self):
166 def init_crash_handler(self):
166 """Create a crash handler, typically setting sys.excepthook to it."""
167 """Create a crash handler, typically setting sys.excepthook to it."""
167 self.crash_handler = self.crash_handler_class(self)
168 self.crash_handler = self.crash_handler_class(self)
168 sys.excepthook = self.excepthook
169 sys.excepthook = self.excepthook
169 def unset_crashhandler():
170 def unset_crashhandler():
170 sys.excepthook = sys.__excepthook__
171 sys.excepthook = sys.__excepthook__
171 atexit.register(unset_crashhandler)
172 atexit.register(unset_crashhandler)
172
173
173 def excepthook(self, etype, evalue, tb):
174 def excepthook(self, etype, evalue, tb):
174 """this is sys.excepthook after init_crashhandler
175 """this is sys.excepthook after init_crashhandler
175
176
176 set self.verbose_crash=True to use our full crashhandler, instead of
177 set self.verbose_crash=True to use our full crashhandler, instead of
177 a regular traceback with a short message (crash_handler_lite)
178 a regular traceback with a short message (crash_handler_lite)
178 """
179 """
179
180
180 if self.verbose_crash:
181 if self.verbose_crash:
181 return self.crash_handler(etype, evalue, tb)
182 return self.crash_handler(etype, evalue, tb)
182 else:
183 else:
183 return crashhandler.crash_handler_lite(etype, evalue, tb)
184 return crashhandler.crash_handler_lite(etype, evalue, tb)
184
185
185 def _ipython_dir_changed(self, name, old, new):
186 def _ipython_dir_changed(self, name, old, new):
186 if old in sys.path:
187 if old in sys.path:
187 sys.path.remove(old)
188 sys.path.remove(old)
188 sys.path.append(os.path.abspath(new))
189 sys.path.append(os.path.abspath(new))
189 if not os.path.isdir(new):
190 if not os.path.isdir(new):
190 os.makedirs(new, mode=0o777)
191 os.makedirs(new, mode=0o777)
191 readme = os.path.join(new, 'README')
192 readme = os.path.join(new, 'README')
192 if not os.path.exists(readme):
193 if not os.path.exists(readme):
193 path = os.path.join(get_ipython_package_dir(), u'config', u'profile')
194 path = os.path.join(get_ipython_package_dir(), u'config', u'profile')
194 shutil.copy(os.path.join(path, 'README'), readme)
195 shutil.copy(os.path.join(path, 'README'), readme)
195 self.log.debug("IPYTHONDIR set to: %s" % new)
196 self.log.debug("IPYTHONDIR set to: %s" % new)
196
197
197 def load_config_file(self, suppress_errors=True):
198 def load_config_file(self, suppress_errors=True):
198 """Load the config file.
199 """Load the config file.
199
200
200 By default, errors in loading config are handled, and a warning
201 By default, errors in loading config are handled, and a warning
201 printed on screen. For testing, the suppress_errors option is set
202 printed on screen. For testing, the suppress_errors option is set
202 to False, so errors will make tests fail.
203 to False, so errors will make tests fail.
203 """
204 """
204 self.log.debug("Searching path %s for config files", self.config_file_paths)
205 self.log.debug("Searching path %s for config files", self.config_file_paths)
205 base_config = 'ipython_config.py'
206 base_config = 'ipython_config.py'
206 self.log.debug("Attempting to load config file: %s" %
207 self.log.debug("Attempting to load config file: %s" %
207 base_config)
208 base_config)
208 try:
209 try:
209 Application.load_config_file(
210 Application.load_config_file(
210 self,
211 self,
211 base_config,
212 base_config,
212 path=self.config_file_paths
213 path=self.config_file_paths
213 )
214 )
214 except ConfigFileNotFound:
215 except ConfigFileNotFound:
215 # ignore errors loading parent
216 # ignore errors loading parent
216 self.log.debug("Config file %s not found", base_config)
217 self.log.debug("Config file %s not found", base_config)
217 pass
218 pass
218 if self.config_file_name == base_config:
219 if self.config_file_name == base_config:
219 # don't load secondary config
220 # don't load secondary config
220 return
221 return
221 self.log.debug("Attempting to load config file: %s" %
222 self.log.debug("Attempting to load config file: %s" %
222 self.config_file_name)
223 self.config_file_name)
223 try:
224 try:
224 Application.load_config_file(
225 Application.load_config_file(
225 self,
226 self,
226 self.config_file_name,
227 self.config_file_name,
227 path=self.config_file_paths
228 path=self.config_file_paths
228 )
229 )
229 except ConfigFileNotFound:
230 except ConfigFileNotFound:
230 # Only warn if the default config file was NOT being used.
231 # Only warn if the default config file was NOT being used.
231 if self.config_file_specified:
232 if self.config_file_specified:
232 msg = self.log.warn
233 msg = self.log.warn
233 else:
234 else:
234 msg = self.log.debug
235 msg = self.log.debug
235 msg("Config file not found, skipping: %s", self.config_file_name)
236 msg("Config file not found, skipping: %s", self.config_file_name)
236 except:
237 except:
237 # For testing purposes.
238 # For testing purposes.
238 if not suppress_errors:
239 if not suppress_errors:
239 raise
240 raise
240 self.log.warn("Error loading config file: %s" %
241 self.log.warn("Error loading config file: %s" %
241 self.config_file_name, exc_info=True)
242 self.config_file_name, exc_info=True)
242
243
243 def init_profile_dir(self):
244 def init_profile_dir(self):
244 """initialize the profile dir"""
245 """initialize the profile dir"""
245 try:
246 try:
246 # location explicitly specified:
247 # location explicitly specified:
247 location = self.config.ProfileDir.location
248 location = self.config.ProfileDir.location
248 except AttributeError:
249 except AttributeError:
249 # location not specified, find by profile name
250 # location not specified, find by profile name
250 try:
251 try:
251 p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
252 p = ProfileDir.find_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
252 except ProfileDirError:
253 except ProfileDirError:
253 # not found, maybe create it (always create default profile)
254 # not found, maybe create it (always create default profile)
254 if self.auto_create or self.profile == 'default':
255 if self.auto_create or self.profile == 'default':
255 try:
256 try:
256 p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
257 p = ProfileDir.create_profile_dir_by_name(self.ipython_dir, self.profile, self.config)
257 except ProfileDirError:
258 except ProfileDirError:
258 self.log.fatal("Could not create profile: %r"%self.profile)
259 self.log.fatal("Could not create profile: %r"%self.profile)
259 self.exit(1)
260 self.exit(1)
260 else:
261 else:
261 self.log.info("Created profile dir: %r"%p.location)
262 self.log.info("Created profile dir: %r"%p.location)
262 else:
263 else:
263 self.log.fatal("Profile %r not found."%self.profile)
264 self.log.fatal("Profile %r not found."%self.profile)
264 self.exit(1)
265 self.exit(1)
265 else:
266 else:
266 self.log.info("Using existing profile dir: %r"%p.location)
267 self.log.info("Using existing profile dir: %r"%p.location)
267 else:
268 else:
268 # location is fully specified
269 # location is fully specified
269 try:
270 try:
270 p = ProfileDir.find_profile_dir(location, self.config)
271 p = ProfileDir.find_profile_dir(location, self.config)
271 except ProfileDirError:
272 except ProfileDirError:
272 # not found, maybe create it
273 # not found, maybe create it
273 if self.auto_create:
274 if self.auto_create:
274 try:
275 try:
275 p = ProfileDir.create_profile_dir(location, self.config)
276 p = ProfileDir.create_profile_dir(location, self.config)
276 except ProfileDirError:
277 except ProfileDirError:
277 self.log.fatal("Could not create profile directory: %r"%location)
278 self.log.fatal("Could not create profile directory: %r"%location)
278 self.exit(1)
279 self.exit(1)
279 else:
280 else:
280 self.log.info("Creating new profile dir: %r"%location)
281 self.log.info("Creating new profile dir: %r"%location)
281 else:
282 else:
282 self.log.fatal("Profile directory %r not found."%location)
283 self.log.fatal("Profile directory %r not found."%location)
283 self.exit(1)
284 self.exit(1)
284 else:
285 else:
285 self.log.info("Using existing profile dir: %r"%location)
286 self.log.info("Using existing profile dir: %r"%location)
286
287
287 self.profile_dir = p
288 self.profile_dir = p
288 self.config_file_paths.append(p.location)
289 self.config_file_paths.append(p.location)
289
290
290 def init_config_files(self):
291 def init_config_files(self):
291 """[optionally] copy default config files into profile dir."""
292 """[optionally] copy default config files into profile dir."""
292 # copy config files
293 # copy config files
293 path = self.builtin_profile_dir
294 path = self.builtin_profile_dir
294 if self.copy_config_files:
295 if self.copy_config_files:
295 src = self.profile
296 src = self.profile
296
297
297 cfg = self.config_file_name
298 cfg = self.config_file_name
298 if path and os.path.exists(os.path.join(path, cfg)):
299 if path and os.path.exists(os.path.join(path, cfg)):
299 self.log.warn("Staging %r from %s into %r [overwrite=%s]"%(
300 self.log.warn("Staging %r from %s into %r [overwrite=%s]"%(
300 cfg, src, self.profile_dir.location, self.overwrite)
301 cfg, src, self.profile_dir.location, self.overwrite)
301 )
302 )
302 self.profile_dir.copy_config_file(cfg, path=path, overwrite=self.overwrite)
303 self.profile_dir.copy_config_file(cfg, path=path, overwrite=self.overwrite)
303 else:
304 else:
304 self.stage_default_config_file()
305 self.stage_default_config_file()
305 else:
306 else:
306 # Still stage *bundled* config files, but not generated ones
307 # Still stage *bundled* config files, but not generated ones
307 # This is necessary for `ipython profile=sympy` to load the profile
308 # This is necessary for `ipython profile=sympy` to load the profile
308 # on the first go
309 # on the first go
309 files = glob.glob(os.path.join(path, '*.py'))
310 files = glob.glob(os.path.join(path, '*.py'))
310 for fullpath in files:
311 for fullpath in files:
311 cfg = os.path.basename(fullpath)
312 cfg = os.path.basename(fullpath)
312 if self.profile_dir.copy_config_file(cfg, path=path, overwrite=False):
313 if self.profile_dir.copy_config_file(cfg, path=path, overwrite=False):
313 # file was copied
314 # file was copied
314 self.log.warn("Staging bundled %s from %s into %r"%(
315 self.log.warn("Staging bundled %s from %s into %r"%(
315 cfg, self.profile, self.profile_dir.location)
316 cfg, self.profile, self.profile_dir.location)
316 )
317 )
317
318
318
319
319 def stage_default_config_file(self):
320 def stage_default_config_file(self):
320 """auto generate default config file, and stage it into the profile."""
321 """auto generate default config file, and stage it into the profile."""
321 s = self.generate_config_file()
322 s = self.generate_config_file()
322 fname = os.path.join(self.profile_dir.location, self.config_file_name)
323 fname = os.path.join(self.profile_dir.location, self.config_file_name)
323 if self.overwrite or not os.path.exists(fname):
324 if self.overwrite or not os.path.exists(fname):
324 self.log.warn("Generating default config file: %r"%(fname))
325 self.log.warn("Generating default config file: %r"%(fname))
325 with open(fname, 'w') as f:
326 with open(fname, 'w') as f:
326 f.write(s)
327 f.write(s)
327
328
328 @catch_config_error
329 @catch_config_error
329 def initialize(self, argv=None):
330 def initialize(self, argv=None):
330 # don't hook up crash handler before parsing command-line
331 # don't hook up crash handler before parsing command-line
331 self.parse_command_line(argv)
332 self.parse_command_line(argv)
332 self.init_crash_handler()
333 self.init_crash_handler()
333 if self.subapp is not None:
334 if self.subapp is not None:
334 # stop here if subapp is taking over
335 # stop here if subapp is taking over
335 return
336 return
336 cl_config = self.config
337 cl_config = self.config
337 self.init_profile_dir()
338 self.init_profile_dir()
338 self.init_config_files()
339 self.init_config_files()
339 self.load_config_file()
340 self.load_config_file()
340 # enforce cl-opts override configfile opts:
341 # enforce cl-opts override configfile opts:
341 self.update_config(cl_config)
342 self.update_config(cl_config)
342
343
@@ -1,25 +1,16 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
6 #
7 # Distributed under the terms of the BSD License. The full license is in
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 import sys
15 import traceback
16
17 from IPython.parallel.apps.ipclusterapp import launch_new_instance
14 from IPython.parallel.apps.ipclusterapp import launch_new_instance
18
15
19 try:
16 launch_new_instance()
20 launch_new_instance()
21 except:
22 exc_type, exc_value, exc_traceback = sys.exc_info()
23 traceback.print_exception(exc_type, exc_value, exc_traceback,
24 file=sys.stderr)
25 sys.exit(1)
@@ -1,25 +1,16 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
6 #
7 # Distributed under the terms of the BSD License. The full license is in
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 import sys
15 import traceback
16
17 from IPython.parallel.apps.ipcontrollerapp import launch_new_instance
14 from IPython.parallel.apps.ipcontrollerapp import launch_new_instance
18
15
19 try:
16 launch_new_instance()
20 launch_new_instance()
21 except:
22 exc_type, exc_value, exc_traceback = sys.exc_info()
23 traceback.print_exception(exc_type, exc_value, exc_traceback,
24 file=sys.stderr)
25 sys.exit(1)
@@ -1,25 +1,16 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
6 #
7 # Distributed under the terms of the BSD License. The full license is in
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 import sys
15 import traceback
16
17 from IPython.parallel.apps.ipengineapp import launch_new_instance
14 from IPython.parallel.apps.ipengineapp import launch_new_instance
18
15
19 try:
16 launch_new_instance()
20 launch_new_instance()
21 except:
22 exc_type, exc_value, exc_traceback = sys.exc_info()
23 traceback.print_exception(exc_type, exc_value, exc_traceback,
24 file=sys.stderr)
25 sys.exit(1)
@@ -1,25 +1,16 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # encoding: utf-8
2 # encoding: utf-8
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Copyright (C) 2008-2009 The IPython Development Team
5 # Copyright (C) 2008-2009 The IPython Development Team
6 #
6 #
7 # Distributed under the terms of the BSD License. The full license is in
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 import sys
15 import traceback
16
17 from IPython.parallel.apps.iploggerapp import launch_new_instance
14 from IPython.parallel.apps.iploggerapp import launch_new_instance
18
15
19 try:
16 launch_new_instance()
20 launch_new_instance()
21 except:
22 exc_type, exc_value, exc_traceback = sys.exc_info()
23 traceback.print_exception(exc_type, exc_value, exc_traceback,
24 file=sys.stderr)
25 sys.exit(1)
@@ -1,15 +1,7 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Terminal-based IPython entry point.
2 """Terminal-based IPython entry point.
3 """
3 """
4 import sys
5 import traceback
6
4
7 from IPython.frontend.terminal.ipapp import launch_new_instance
5 from IPython.frontend.terminal.ipapp import launch_new_instance
8
6
9 try:
7 launch_new_instance()
10 launch_new_instance()
11 except:
12 exc_type, exc_value, exc_traceback = sys.exc_info()
13 traceback.print_exception(exc_type, exc_value, exc_traceback,
14 file=sys.stderr)
15 sys.exit(1)
General Comments 0
You need to be logged in to leave comments. Login now