[IPython-dev] paste magic command not working

Mauricio Calvao mocalvao at gmail.com
Sun Jan 19 09:00:11 EST 2014


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
#######################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140119/ae444388/attachment.html>


More information about the IPython-dev mailing list