##// END OF EJS Templates
Prevent ipython.py launcher from being imported.
Stefan van der Walt -
Show More
@@ -1,18 +1,23 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # -*- coding: utf-8 -*-
3 """IPython -- An enhanced Interactive Python
3 """IPython -- An enhanced Interactive Python
4
4
5 The actual ipython script to be installed with 'python setup.py install' is
5 The actual ipython script to be installed with 'python setup.py install' is
6 in './scripts' directory. This file is here (ipython source root directory)
6 in './scripts' directory. This file is here (ipython source root directory)
7 to facilitate non-root 'zero-installation' (just copy the source tree
7 to facilitate non-root 'zero-installation' (just copy the source tree
8 somewhere and run ipython.py) and development. """
8 somewhere and run ipython.py) and development. """
9
9
10 if __name__ != "__main__":
11 raise RuntimeError('You are trying to import the ipython.py executable. '
12 'Did you mean to call "import IPython" (case-sensitive) instead?')
13
10 # Ensure that the imported IPython is the local one, not a system-wide one
14 # Ensure that the imported IPython is the local one, not a system-wide one
11 import os, sys
15 import os, sys
12 this_dir = os.path.dirname(sys.argv[0])
16 this_dir = os.path.dirname(sys.argv[0])
13 sys.path.insert(0, this_dir)
17 sys.path.insert(0, this_dir)
14
18
15 # Now proceed with execution
19 # Now proceed with execution
16 execfile(os.path.join(
20 execfile(os.path.join(
17 this_dir, 'IPython', 'scripts', 'ipython'
21 this_dir, 'IPython', 'scripts', 'ipython'
18 ))
22 ))
23
General Comments 0
You need to be logged in to leave comments. Login now