Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

%ed magic fails in qtconsole #2085

Closed
ibeex opened this Issue · 3 comments

5 participants

@ibeex

%edit works as expected but %ed fails

%ed
IPython will make a temporary file named: /var/folders/gw/ttdxvysn20sf7tspmk384q000000gn/T/ipython_edit_d2eA7c.py
Editing...---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-649c77c2a5b5> in <module>()
----> 1 get_ipython().magic(u'ed')

/Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2159         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2160         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2161         return self.run_line_magic(magic_name, magic_arg_s)
   2162 
   2163     #-------------------------------------------------------------------------

/Library/Python/2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2085                 args.append(sys._getframe(stack_depth).f_locals)
   2086             with self.builtin_trap:
-> 2087                 result = fn(*args)
   2088             return result
   2089 

/Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in ed(self, parameter_s)

/Library/Python/2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    189     # but it's overkill for just that one bit of state.
    190     def magic_deco(arg):
--> 191         call = lambda f, *a, **k: f(*a, **k)
    192 
    193         if callable(arg):

/Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in ed(self, parameter_s)
    327     def ed(self, parameter_s=''):
    328         """Alias to %edit."""
--> 329         return self.edit(parameter_s)
    330 
    331     @skip_doctest

/Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in edit(self, parameter_s, last_call)

/Library/Python/2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    189     # but it's overkill for just that one bit of state.
    190     def magic_deco(arg):
--> 191         call = lambda f, *a, **k: f(*a, **k)
    192 
    193         if callable(arg):

/Library/Python/2.7/site-packages/IPython/core/magics/code.pyc in edit(self, parameter_s, last_call)
    490             if ' ' in filename:
    491                 filename = "'%s'" % filename
--> 492             self.shell.hooks.editor(filename,lineno)
    493         except TryNext:
    494             warn('Could not open editor')

/Library/Python/2.7/site-packages/IPython/core/hooks.pyc in __call__(self, *args, **kw)
    136             #print "prio",prio,"cmd",cmd #dbg
    137             try:
--> 138                 return cmd(*args, **kw)
    139             except TryNext as exc:
    140                 last_exc = exc

/Library/Python/2.7/site-packages/IPython/core/hooks.pyc in editor(self, filename, linenum, wait)
     65     # IPython configures a default editor at startup by reading $EDITOR from
     66     # the environment, and falling back on vi (unix) or notepad (win32).
---> 67     editor = self.editor
     68 
     69     # marker for at which line to open the file (for existing objects)

AttributeError: 'ZMQInteractiveShell' object has no attribute 'editor'
@Carreau Carreau referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Carreau
Owner

#2086 should fix it if you are runing from dev.

@bfroehle

As a temporary workaround, you should be able to run:

%alias_magic ed edit
@fperez
Owner

And as I commented in #2085, the full fix should also use alias_magic rather than writing a new method by hand. We should provide all of our historical aliases that way.

@Carreau Carreau referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Carreau Carreau closed this in a9e7148
@doda doda referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Carreau Carreau referenced this issue from a commit in Carreau/ipython
@Carreau Carreau re-aliad %ed to %edit in qtconsole
fixes #2085

backported to 0.13.1 from PR #2086
765bae8
@minrk minrk referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@minrk minrk referenced this issue from a commit
@minrk minrk Backport PR #2086: re-aliad %ed to %edit in qtconsole
fixes #2085

should be backported to 0.13.1
1c1222f
@minrk minrk added this to the 1.0 milestone
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@Carreau Carreau re-aliad %ed to %edit in qtconsole
fixes #2085
e695d1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.