I use python 2.7. I installed pyperclip using sudo pip install pyperclip
and it was installed successfully.
Every time I use the following simple code
import pyperclip
pyperclip.copy('Hello World')
message=pyperclip.paste()
print (message)
I get the following error:
/usr/lib/python2.7/dist-packages/gtk-2.0/gtk/__init__.py:57:
GtkWarning: could not open display warnings.warn(str(e),
_gtk.Warning) /usr/local/lib/python2.7/dist-packages/pyperclip/__init__.py:102:
GtkWarning: IA__gtk_clipboard_get_for_display: assertion 'display !=
NULL' failed cb = gtk.Clipboard() Traceback (most recent call last):
File "first.py", line 401, in <module>
pyperclip.copy('Hello World') File "/usr/local/lib/python2.7/dist-packages/pyperclip/__init__.py", line
102, in _copyGtk
cb = gtk.Clipboard() RuntimeError: could not create GtkClipboard object
sudo pip
; either use a virtualenv orpip install --user
. – Pauli