Permalink
Browse files

Allow loadpy to load remote URLs that don't end in .py

  • Loading branch information...
1 parent 4626066 commit 1a932e1028bdad665700a0e1626dcf8290f65ff9 @fperez fperez committed Dec 15, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 IPython/core/magic.py
View
@@ -2151,7 +2151,11 @@ def magic_loadpy(self, arg_s):
%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://', 'https://')) \
+ 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

0 comments on commit 1a932e1

Please sign in to comment.