MCPcopy Index your code
hub / github.com/ipython/ipython / _run_startup_files

Method _run_startup_files

IPython/core/shellapp.py:415–443  ·  view source on GitHub ↗

Run files from profile startup directory

(self)

Source from the content-addressed store, hash-verified

413 sys.argv = save_argv
414
415 def _run_startup_files(self):
416 """Run files from profile startup directory"""
417 startup_dirs = [self.profile_dir.startup_dir] + [
418 os.path.join(p, 'startup') for p in chain(ENV_CONFIG_DIRS, SYSTEM_CONFIG_DIRS)
419 ]
420 startup_files = []
421
422 if self.exec_PYTHONSTARTUP and os.environ.get('PYTHONSTARTUP', False) and \
423 not (self.file_to_run or self.code_to_run or self.module_to_run):
424 python_startup = os.environ['PYTHONSTARTUP']
425 self.log.debug("Running PYTHONSTARTUP file %s...", python_startup)
426 try:
427 self._exec_file(python_startup)
428 except:
429 self.log.warning("Unknown error in handling PYTHONSTARTUP file %s:", python_startup)
430 self.shell.showtraceback()
431 for startup_dir in startup_dirs[::-1]:
432 startup_files += glob.glob(os.path.join(startup_dir, '*.py'))
433 startup_files += glob.glob(os.path.join(startup_dir, '*.ipy'))
434 if not startup_files:
435 return
436
437 self.log.debug("Running startup files from %s...", startup_dir)
438 try:
439 for fname in sorted(startup_files):
440 self._exec_file(fname)
441 except:
442 self.log.warning("Unknown error in handling startup files:")
443 self.shell.showtraceback()
444
445 def _run_exec_files(self):
446 """Run files from IPythonApp.exec_files"""

Callers 1

init_codeMethod · 0.95

Calls 4

_exec_fileMethod · 0.95
getMethod · 0.80
debugMethod · 0.80
showtracebackMethod · 0.45

Tested by

no test coverage detected