Show More
@@ -172,6 +172,10 b' class InteractiveShellApp(Configurable):' | |||||
172 | exec_files = List(Unicode, config=True, |
|
172 | exec_files = List(Unicode, config=True, | |
173 | help="""List of files to run at IPython startup.""" |
|
173 | help="""List of files to run at IPython startup.""" | |
174 | ) |
|
174 | ) | |
|
175 | exec_PYTHONSTARTUP = Bool(True, config=True, | |||
|
176 | help="""Run the file referenced by the PYTHONSTARTUP environment | |||
|
177 | variable at IPython startup.""" | |||
|
178 | ) | |||
175 | file_to_run = Unicode('', config=True, |
|
179 | file_to_run = Unicode('', config=True, | |
176 | help="""A file to be run""") |
|
180 | help="""A file to be run""") | |
177 |
|
181 | |||
@@ -354,6 +358,7 b' class InteractiveShellApp(Configurable):' | |||||
354 | """Run files from profile startup directory""" |
|
358 | """Run files from profile startup directory""" | |
355 | startup_dir = self.profile_dir.startup_dir |
|
359 | startup_dir = self.profile_dir.startup_dir | |
356 | startup_files = [] |
|
360 | startup_files = [] | |
|
361 | if self.exec_PYTHONSTARTUP: | |||
357 | if os.environ.get('PYTHONSTARTUP', False): |
|
362 | if os.environ.get('PYTHONSTARTUP', False): | |
358 | startup_files.append(os.environ['PYTHONSTARTUP']) |
|
363 | startup_files.append(os.environ['PYTHONSTARTUP']) | |
359 | startup_files += glob.glob(os.path.join(startup_dir, '*.py')) |
|
364 | startup_files += glob.glob(os.path.join(startup_dir, '*.py')) |
@@ -761,10 +761,10 b" won't work::" | |||||
761 | IPython as your default Python environment |
|
761 | IPython as your default Python environment | |
762 | ========================================== |
|
762 | ========================================== | |
763 |
|
763 | |||
764 |
Python honors the environment variable PYTHONSTARTUP and will |
|
764 | Python honors the environment variable :envvar:`PYTHONSTARTUP` and will | |
765 |
startup the file referenced by this variable. If you put the |
|
765 | execute at startup the file referenced by this variable. If you put the | |
766 |
the end of that file, then IPython will be your working |
|
766 | following code at the end of that file, then IPython will be your working | |
767 | start Python:: |
|
767 | environment anytime you start Python:: | |
768 |
|
768 | |||
769 | from IPython.frontend.terminal.ipapp import launch_new_instance |
|
769 | from IPython.frontend.terminal.ipapp import launch_new_instance | |
770 | launch_new_instance() |
|
770 | launch_new_instance() | |
@@ -774,6 +774,11 b' The ``raise SystemExit`` is needed to exit Python when' | |||||
774 | it finishes, otherwise you'll be back at the normal Python '>>>' |
|
774 | it finishes, otherwise you'll be back at the normal Python '>>>' | |
775 | prompt. |
|
775 | prompt. | |
776 |
|
776 | |||
|
777 | You'll also need to set the config option | |||
|
778 | ``InteractiveShellApp.exec_PYTHONSTARTUP = False``, otherwise IPython | |||
|
779 | will try to run :envvar:`PYTHONSTARTUP` again, sending it into an | |||
|
780 | infinite loop. | |||
|
781 | ||||
777 | This is probably useful to developers who manage multiple Python |
|
782 | This is probably useful to developers who manage multiple Python | |
778 | versions and don't want to have correspondingly multiple IPython |
|
783 | versions and don't want to have correspondingly multiple IPython | |
779 | versions. Note that in this mode, there is no way to pass IPython any |
|
784 | versions. Note that in this mode, there is no way to pass IPython any |
General Comments 0
You need to be logged in to leave comments.
Login now