Show More
@@ -172,6 +172,10 b' class InteractiveShellApp(Configurable):' | |||
|
172 | 172 | exec_files = List(Unicode, config=True, |
|
173 | 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 | 179 | file_to_run = Unicode('', config=True, |
|
176 | 180 | help="""A file to be run""") |
|
177 | 181 | |
@@ -354,8 +358,9 b' class InteractiveShellApp(Configurable):' | |||
|
354 | 358 | """Run files from profile startup directory""" |
|
355 | 359 | startup_dir = self.profile_dir.startup_dir |
|
356 | 360 | startup_files = [] |
|
357 |
if |
|
|
358 |
|
|
|
361 | if self.exec_PYTHONSTARTUP: | |
|
362 | if os.environ.get('PYTHONSTARTUP', False): | |
|
363 | startup_files.append(os.environ['PYTHONSTARTUP']) | |
|
359 | 364 | startup_files += glob.glob(os.path.join(startup_dir, '*.py')) |
|
360 | 365 | startup_files += glob.glob(os.path.join(startup_dir, '*.ipy')) |
|
361 | 366 | if not startup_files: |
@@ -761,10 +761,10 b" won't work::" | |||
|
761 | 761 | IPython as your default Python environment |
|
762 | 762 | ========================================== |
|
763 | 763 | |
|
764 |
Python honors the environment variable PYTHONSTARTUP and will |
|
|
765 |
startup the file referenced by this variable. If you put the |
|
|
766 |
the end of that file, then IPython will be your working |
|
|
767 | start Python:: | |
|
764 | Python honors the environment variable :envvar:`PYTHONSTARTUP` and will | |
|
765 | execute at startup the file referenced by this variable. If you put the | |
|
766 | following code at the end of that file, then IPython will be your working | |
|
767 | environment anytime you start Python:: | |
|
768 | 768 | |
|
769 | 769 | from IPython.frontend.terminal.ipapp import launch_new_instance |
|
770 | 770 | launch_new_instance() |
@@ -774,6 +774,11 b' The ``raise SystemExit`` is needed to exit Python when' | |||
|
774 | 774 | it finishes, otherwise you'll be back at the normal Python '>>>' |
|
775 | 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 | 782 | This is probably useful to developers who manage multiple Python |
|
778 | 783 | versions and don't want to have correspondingly multiple IPython |
|
779 | 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