%paste magic function on ipython3

15

1

I'm using ipython3, installed on Ubuntu with apt-get. I can't use the paste magic function, it complains about missing Tkinter. But I do have Tkinter and the same thing works fine on ipython (2). What gives?

Python 3.2.3 (default, Oct 19 2012, 19:53:16) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1.rc2 -- 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.

In [1]: %paste
ERROR: Getting text from the clipboard on this platform requires Tkinter.

wim

Posted 2013-02-10T23:53:09.590

Reputation: 2 523

What do you get from import Tkinter; print(Tkinter)? – minrk – 2013-02-11T01:12:59.337

/usr/lib/python2.7/lib-tk/Tkinter.pyc on 2.7, import error on ipython3 – wim – 2013-02-11T01:14:24.750

Answers

28

minrk comment got me on the right track, and I've fixed it with the following package.

sudo apt-get install python3-tk

wim

Posted 2013-02-10T23:53:09.590

Reputation: 2 523

%paste dose not work even after installing python3-tk. %cpaste dose – 7kemZmani – 2019-03-21T19:16:07.967

12+1 is the same fot python2.7: sudo apt-get install python-tk – chespinoza – 2013-05-28T13:33:17.413

4

To be extra clear: wim's answer also works for python2.7, to cover all versions simply run:

sudo apt-get install python-tk

as eluded to by cespinoza

hello_there_andy

Posted 2013-02-10T23:53:09.590

Reputation: 329