Show More
@@ -358,9 +358,23 b' class InteractiveShellApp(Configurable):' | |||
|
358 | 358 | """Run files from profile startup directory""" |
|
359 | 359 | startup_dir = self.profile_dir.startup_dir |
|
360 | 360 | startup_files = [] |
|
361 | if self.exec_PYTHONSTARTUP and not (self.file_to_run or self.code_to_run or self.module_to_run): | |
|
362 |
|
|
|
363 | startup_files.append(os.environ['PYTHONSTARTUP']) | |
|
361 | ||
|
362 | if self.exec_PYTHONSTARTUP and os.environ.get('PYTHONSTARTUP', False) and \ | |
|
363 | not (self.file_to_run or self.code_to_run or self.module_to_run): | |
|
364 | python_startup = os.environ['PYTHONSTARTUP'] | |
|
365 | self.log.debug("Running PYTHONSTARTUP file %s...", python_startup) | |
|
366 | try: | |
|
367 | self._exec_file(python_startup) | |
|
368 | except: | |
|
369 | self.log.warn("Unknown error in handling PYTHONSTARTUP file %s:", python_startup) | |
|
370 | self.shell.showtraceback() | |
|
371 | finally: | |
|
372 | # Many PYTHONSTARTUP files set up the readline completions, | |
|
373 | # but this is often at odds with IPython's own completions. | |
|
374 | # Do not allow PYTHONSTARTUP to set up readline. | |
|
375 | if self.shell.has_readline: | |
|
376 | self.shell.set_readline_completer() | |
|
377 | ||
|
364 | 378 | startup_files += glob.glob(os.path.join(startup_dir, '*.py')) |
|
365 | 379 | startup_files += glob.glob(os.path.join(startup_dir, '*.ipy')) |
|
366 | 380 | if not startup_files: |
General Comments 0
You need to be logged in to leave comments.
Login now