Created
December 15, 2011 23:00
-
-
Save fperez/1483383 to your computer and use it in GitHub Desktop.
IPython impromptu PR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/IPython/core/magic.py b/IPython/core/magic.py | |
index ee84680..f82b43f 100644 | |
--- a/IPython/core/magic.py | |
+++ b/IPython/core/magic.py | |
@@ -2151,7 +2151,10 @@ Currently the magic system has the following functions:\n""" | |
%loadpy http://www.example.com/myscript.py | |
""" | |
arg_s = unquote_filename(arg_s) | |
- if not arg_s.endswith('.py'): | |
+ if not arg_s.startswith('http') and not arg_s.endswith('.py'): | |
+ # Local files must be .py; for remote URLs it's possible that the | |
+ # fetch URL doesn't have a .py in it (many servers have an opaque | |
+ # URL, such as scipy-central.org). | |
raise ValueError('%%load only works with .py files: %s' % arg_s) | |
if arg_s.startswith('http'): | |
import urllib2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment