Why can't I paste using python3 pyperclip in Debian 12?

93 Views Asked by At

In Chapter 6 of Automate the Boring Stuff with Python (by Sweigart) the following example usage of pyperclip is given for copying 'Hello, world'! to the clipboard. However when pressing Ctrl + V in a text editor after running the example code, 'Hello, world!' does not appear.

import pyperclip
pyperclip.copy('Hello, world'!)
pyperclip.paste()

I was expecting to see 'Hello, world!' when pressing Ctrl + V in a text editor. I've tried installing xsel and xclip [1] according to the instructions on the author's github. The 'mclip.py' code example also does not seem to copy any text to the clipboard however it does not give an error message. Searching for a solution seems to turn up cases where installing xclip/xsel provides a remedy.

Python version is Python 3.11.2 on Linux debian 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 GNU/Linux. Pyperclip version is 1.8.2-2 installed via apt. python3-pyqt5 is version: 5.15.9+dfsg-1.

More details are here: https://pastebin.com/P6jQSBdr

[1] https://github.com/asweigart/pyperclip

0

There are 0 best solutions below