##// END OF EJS Templates
Avoid recursion from $PYTHONSTARTUP...
Thomas Kluyver -
Show More
@@ -766,19 +766,15 execute at startup the file referenced by this variable. If you put the
766 766 following code at the end of that file, then IPython will be your working
767 767 environment anytime you start Python::
768 768
769 from IPython.frontend.terminal.ipapp import launch_new_instance
770 launch_new_instance()
769 import os, IPython
770 os.environ['PYTHONSTARTUP'] = '' # Prevent running this again
771 IPython.start_ipython()
771 772 raise SystemExit
772 773
773 774 The ``raise SystemExit`` is needed to exit Python when
774 775 it finishes, otherwise you'll be back at the normal Python '>>>'
775 776 prompt.
776 777
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
782 778 This is probably useful to developers who manage multiple Python
783 779 versions and don't want to have correspondingly multiple IPython
784 780 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