pyperclip: Pyperclip does not persist if called from script

I want to store something into the clipboard via a python script. It’s basically just pyperclip.copy('text'). I’m using Fedora 21 with AwesomeWM. I read here that a clipboard manager is needed to store it permanent in the clipboard. I installed parcellite. It now works, if I use it in an terminal, via

$python
$>>> import pyperclip
$>>> pyperclip.copy('teststring')

BUT if I do the exact same thing in an script

import pyperclip
pyperclip.copy('teststring')

and execute this script with python filename. It won’t get stored in the clipboard.

Any ideas on where the error may happen?

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 10
  • Comments: 23 (1 by maintainers)

Most upvoted comments

guys, u need xclip n xsel:

sudo apt-get install xclip xsel

For Arch based, sudo yay -S xclip xsel