0

I need my program to copy some text to the clipboard. For that, I thought of using the pyperclip library. But every time I run my code an error appears "Pyperclip could not find a copy/paste mechanism for you system."

I´ve experimented doing a simple program of the likes:

import pyperclip

name = input("Enter your name: ")

pyperclip.copy(name)

To see if the problem was because of my code, but it turns out the problem still appears. So it must be because of the system/environment. I´m looking for any tips on changing something on VSCode too see if the problem stops.

The error message

I´ve tried logging into VSCode on both PC and Mac and the problem still occurs.

Jamiu S.
  • 5,257
  • 5
  • 12
  • 34
  • Does it work if you run the file from the command line? – MattDMo Dec 12 '22 at 19:15
  • 1
    I seems that you are running this from remote (on the error message, I see Ubuntu path). You probably need to install `xclip` on the linux machine `sudo apt-get install xclip`. [See](https://pypi.org/project/pyperclip/). This is not related to VScode. – Kaymal Dec 12 '22 at 20:59
  • **I´ve tried logging into VSCode on both PC and Mac and the problem still occurs.** However, the path in your figure shows that you used ubuntu. – MingJie-MSFT Dec 13 '22 at 01:56

0 Answers0