[IPython-dev] paste magic command not working
Mauricio Calvao
mocalvao at gmail.com
Mon Jan 20 12:56:35 EST 2014
Ok Matthias,
I will try to contact jtaylor; thanks again!
On Mon, Jan 20, 2014 at 12:15 PM, Matthias BUSSONNIER <
bussonniermatthias at gmail.com> wrote:
> Hi Mauricio,
>
> Be careful when modifying system files, your updates might not behave
> correctly afterwards.
> The differences between your file (debian) and original one seem to be due
> to a custom debian patch
> (cc jtaylor as he appears to be the author of
> debianize-error-messages.patch).
>
> --
> Matthias
>
> Le 19 janv. 2014 à 20:20, Mauricio Calvao a écrit :
>
> > Hi Matthias
> >
> > I have checked my clipboard.py file in
> /usr/lib/python2.7/dist-packages/IPython/lib/. There is a new corresponding
> .pyc, so I guess its staleness is not an option to explain the error.
> However, I verified that in the clipboard.py file itself there is an
> additional line as compared to the link you gave; it is in the fucntion
> definition tkinter_clipboard_get, which is the one which must be used,
> because I am in a Linux box (Debian). Explicitly, this (small) function
> definition, inside clipboard.py, reads:
> >
> > def tkinter_clipboard_get():
> > """ Get the clipboard's text using Tkinter.
> >
> > This is the default on systems that are not Windows or OS X. It may
> > interfere with other UI toolkits and should be replaced with an
> > implementation that uses that toolkit.
> > """
> > try:
> > import Tkinter
> > except ImportError:
> > from IPython.utils import py3compat
> > raise TryNext("Getting text from the clipboard on this platform "
> > "requires the %s-tk package." % ("python3" if
> py3compat.PY3 else "python"))
> > root = Tkinter.Tk()
> > root.withdraw()
> > text = root.clipboard_get()
> > root.destroy()
> > text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING)
> > return text
> >
> > The additional line, nonexistent in the link you gave, is the one "from
> IPython.utils import py3compat". I have now commented it out and everything
> seems to be working fine again! Thanks.
> >
> >
> > On Sun, Jan 19, 2014 at 3:47 PM, Matthias BUSSONNIER <
> bussonniermatthias at gmail.com> wrote:
> > Hi,
> >
> > You can open an issue on github, but the py3compat import is here on
> 1.1.0:
> >
> >
> https://github.com/ipython/ipython/blob/rel-1.1.0/IPython/lib/clipboard.py#L7
> >
> > Could you have stale .pyc cache or things like that ?
> >
> > --
> > M
> >
> > Le 19 janv. 2014 à 15:00, Mauricio Calvao a écrit :
> >
> > > Hi there,
> > >
> > > I used to have a working ipython environment, including the qtconsole
> and notebook, besides the command line. After a dist-upgrade of my Debian,
> everything still seems to be working fine, except for the paste magic
> command, which issues the message:
> > >
> > > In [1]: paste
> > >
> ---------------------------------------------------------------------------
> > > UnboundLocalError Traceback (most recent call
> last)
> > > <ipython-input-1-84f91d8a6054> in <module>()
> > > ----> 1 get_ipython().magic(u'paste ')
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in
> magic(self, arg_s)
> > > 2170 magic_name, _, magic_arg_s = arg_s.partition(' ')
> > > 2171 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
> > > -> 2172 return self.run_line_magic(magic_name, magic_arg_s)
> > > 2173
> > > 2174
> #-------------------------------------------------------------------------
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in
> run_line_magic(self, magic_name, line)
> > > 2091 kwargs['local_ns'] =
> sys._getframe(stack_depth).f_locals
> > > 2092 with self.builtin_trap:
> > > -> 2093 result = fn(*args,**kwargs)
> > > 2094 return result
> > > 2095
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/terminal/interactiveshell.pyc
> in paste(self, parameter_s)
> > >
> > > /usr/lib/python2.7/dist-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):
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/terminal/interactiveshell.pyc
> in paste(self, parameter_s)
> > > 216 return
> > > 217 try:
> > > --> 218 block = self.shell.hooks.clipboard_get()
> > > 219 except TryNext as clipboard_exc:
> > > 220 message = getattr(clipboard_exc, 'args')
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/core/hooks.pyc in
> __call__(self, *args, **kw)
> > > 130 #print "prio",prio,"cmd",cmd #dbg
> > > 131 try:
> > > --> 132 return cmd(*args, **kw)
> > > 133 except TryNext as exc:
> > > 134 last_exc = exc
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/core/hooks.pyc in
> clipboard_get(self)
> > > 221 for func in chain:
> > > 222 dispatcher.add(func)
> > > --> 223 text = dispatcher()
> > > 224 return text
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/core/hooks.pyc in
> __call__(self, *args, **kw)
> > > 130 #print "prio",prio,"cmd",cmd #dbg
> > > 131 try:
> > > --> 132 return cmd(*args, **kw)
> > > 133 except TryNext as exc:
> > > 134 last_exc = exc
> > >
> > > /usr/lib/python2.7/dist-packages/IPython/lib/clipboard.pyc in
> tkinter_clipboard_get()
> > > 51 text = root.clipboard_get()
> > > 52 root.destroy()
> > > ---> 53 text = py3compat.cast_unicode(text,
> py3compat.DEFAULT_ENCODING)
> > > 54 return text
> > > 55
> > >
> > > UnboundLocalError: local variable 'py3compat' referenced before
> assignment
> > >
> > > In [2]: can't invoke "event" command: application has been destroyed
> > > while executing
> > > "event generate $w <<ThemeChanged>>"
> > > (procedure "ttk::ThemeChanged" line 6)
> > > invoked from within
> > > "ttk::ThemeChanged"
> > >
> > >
> > > In [2]:
> > >
> > >
> > >
> > > after I try to paste the simple line:
> > >
> > > import numpy as np
> > >
> > >
> > > My Python and Ipython versions are:
> > >
> > > orca at andromeda:~$ ipython
> > > Python 2.7.6 (default, Jan 11 2014, 14:34:26)
> > > Type "copyright", "credits" or "license" for more information.
> > >
> > > IPython 1.1.0 -- An enhanced Interactive Python.
> > > ? -> Introduction and overview of IPython's features.
> > > %quickref -> Quick reference.
> > > help -> Python's own help system.
> > > object? -> Details about 'object', use 'object??' for extra details.
> > >
> > >
> > > Any suggestions please?
> > >
> > > Regards!
> > >
> > >
> > > --
> > > #######################################
> > > Prof. Mauricio Ortiz Calvao
> > > Federal University of Rio de Janeiro
> > > Institute of Physics, P O Box 68528
> > > CEP 21941-972 Rio de Janeiro, RJ
> > > Brazil
> > >
> > > Email: orca at if.ufrj.br
> > > Phone: (55)(21)25627483
> > > Homepage: http://www.if.ufrj.br/~orca
> > > #######################################
> > > _______________________________________________
> > > IPython-dev mailing list
> > > IPython-dev at scipy.org
> > > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev at scipy.org
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
> >
> >
> >
> > --
> > #######################################
> > Prof. Mauricio Ortiz Calvao
> > Federal University of Rio de Janeiro
> > Institute of Physics, P O Box 68528
> > CEP 21941-972 Rio de Janeiro, RJ
> > Brazil
> >
> > Email: orca at if.ufrj.br
> > Phone: (55)(21)25627483
> > Homepage: http://www.if.ufrj.br/~orca
> > #######################################
> > _______________________________________________
> > IPython-dev mailing list
> > IPython-dev at scipy.org
> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
--
#######################################
Prof. Mauricio Ortiz Calvao
Federal University of Rio de Janeiro
Institute of Physics, P O Box 68528
CEP 21941-972 Rio de Janeiro, RJ
Brazil
Email: orca at if.ufrj.br
Phone: (55)(21)25627483
Homepage: http://www.if.ufrj.br/~orca
#######################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140120/b45d0a05/attachment.html>
More information about the IPython-dev
mailing list