Skip to content
This repository

Prevent ipython.py launcher from being imported. #702

Merged
merged 1 commit into from over 2 years ago

2 participants

Stefan van der Walt Fernando Perez
Stefan van der Walt

Suggest importing IPython instead.

Fernando Perez
Owner

Thanks!

Fernando Perez fperez merged commit afb8686 into from
Fernando Perez fperez closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 15, 2011
Stefan van der Walt Prevent ipython.py launcher from being imported. afb8686
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. 5  ipython.py
5  ipython.py
@@ -7,6 +7,10 @@
7 7
 to facilitate non-root 'zero-installation' (just copy the source tree
8 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 14
 # Ensure that the imported IPython is the local one, not a system-wide one
11 15
 import os, sys
12 16
 this_dir = os.path.dirname(sys.argv[0])
@@ -16,3 +20,4 @@
16 20
 execfile(os.path.join(
17 21
     this_dir, 'IPython', 'scripts', 'ipython'
18 22
 ))
  23
+
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.