[IPython-dev] paste magic command not working

Julian Taylor jtaylor.debian at googlemail.com
Mon Jan 20 13:47:52 EST 2014


On 20.01.2014 15:15, Matthias BUSSONNIER 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).
> 

sorry the patch seems broken and I'll fix it in the next upload.
but can someone explain to me why its broken?
how can an import that is never called cause an unbound name error?

import IPython.utils.py3compat as py3compat
def tkinter_clipboard_get():
    try:
        import tkinter
    except ImportError:
        import IPython.utils.py3compat as py3compat
        raise TryNext("%s" % ("python3" if py3compat.PY3 else "python"))
    root = tkinter.Tk()
    root.withdraw()
    text = root.clipboard_get()
    root.destroy()
    # error here after successful tkinter import
    text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING)
    return text




More information about the IPython-dev mailing list