diff --git a/IPython/core/magic.py b/IPython/core/magic.py index bf85ea1..25ffa40 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -2093,6 +2093,24 @@ Currently the magic system has the following functions:\n""" pbserver = ServerProxy('http://paste.pocoo.org/xmlrpc/') id = pbserver.pastes.newPaste("python", code) return "http://paste.pocoo.org/show/" + id + + def magic_loadpy(self, arg_s): + """Load a .py python script into the GUI console. + + This magic command can either take a local filename or a url:: + + %loadpy myscript.py + %loadpy http://www.example.com/myscript.py + """ + if not arg_s.endswith('.py'): + raise ValueError('%%load only works with .py files: %s' % arg_s) + if arg_s.startswith('http'): + import urllib2 + response = urllib2.urlopen(arg_s) + content = response.read() + else: + content = open(arg_s).read() + self.set_next_input(content) def _edit_macro(self,mname,macro): """open an editor with the macro data in a file""" diff --git a/IPython/zmq/zmqshell.py b/IPython/zmq/zmqshell.py index e7f1e00..8306a20 100644 --- a/IPython/zmq/zmqshell.py +++ b/IPython/zmq/zmqshell.py @@ -575,24 +575,6 @@ class ZMQInteractiveShell(InteractiveShell): """Show a basic reference about the GUI console.""" from IPython.core.usage import gui_reference page.page(gui_reference, auto_html=True) - - def magic_loadpy(self, arg_s): - """Load a .py python script into the GUI console. - - This magic command can either take a local filename or a url:: - - %loadpy myscript.py - %loadpy http://www.example.com/myscript.py - """ - if not arg_s.endswith('.py'): - raise ValueError('%%load only works with .py files: %s' % arg_s) - if arg_s.startswith('http'): - import urllib2 - response = urllib2.urlopen(arg_s) - content = response.read() - else: - content = open(arg_s).read() - self.set_next_input(content) def set_next_input(self, text): """Send the specified text to the frontend to be presented at the next