Forums

Any alternative to solve "Pyperclip copy to clipboard function" error?

I use Pyperclip for copy to clipboard purpose, and got an error of "Pyperclip could not find a copy/paste mechanism for your system.", it is because lack of "sudo apt-get install xclip", since user have no authority to do this command in pythonanywhere, please give me an advise to get the same functionality.

There's no clipboard on PythonAnywhere, since this is a server environment. What are you trying to accomplish?

Hello, I hope it's okay to post into this old thread. I use PythonAnywhere to host a dash web app. I also ran into an issue recently where I was copying a table of data into a clipboard.

clipContent = finaltableDF.to_clipboard(excel=True, sep=None, index=False, header=True)

This would not function because it seems to require Pyperclip/xclip or some other dependency. I'm able to get items from the site into the user clipboard, but I'm forced to use

clipContent = finaltableDF.to_csv(sep=',', index=False, header=True)

This output isn't ideal because when pasting it into excel, it all crams into 1 cell instead of pasting into respective cells. BUT, I understand now that this specific method copies to the server’s clipboard, rather than the client’s. Hopefully this information helps someone anyway. Prost!

Code running on server is running on server and is unable to interact directly with client's machine. Code running in client's browser is able to do it.