Aditya Chandel
Aditya Chandel

Reputation: 115

Read clipboard not working in jupyter or terminal

I was learning pandas and I am stuck with this read_clipboard issue.

nfl_frame = pd.read_clipboard()

this is the error that i get

    AttributeError                            Traceback (most recent call last)
<ipython-input-30-cab596b16d61> in <module>()
----> 1 nfl = pd.read_clipboard()

/home/aditya/anaconda3/lib/python3.5/site-packages/pandas/io/clipboard.py in read_clipboard(**kwargs)
     18     from pandas.io.parsers import read_table
     19     text = clipboard_get()
---> 20     text = text.decode('UTF-8')
     21 
     22     # try to decode (if needed on PY3)

AttributeError: 'str' object has no attribute 'decode'

Part of clipboard.py file

from pandas.util.clipboard import clipboard_get
from pandas.io.parsers import read_table
text = clipboard_get()
text = text.decode('UTF-8')

Upvotes: 3

Views: 1871

Answers (1)

Phil Sheard
Phil Sheard

Reputation: 2162

The exception error message is telling you that you need some additional helper software installed:

"Pyperclip requires the gtk, PyQt4, or PySide module installed, or either the xclip or xsel command"

You could install any of these to get this working. As you're developing on Ubuntu, the simplest way would probably to install either xclip or xsel:

sudo apt-get install xclip

Upvotes: 7

Related Questions