1

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.

Community
  • 1
  • 1
Sheldan
  • 73
  • 11

1 Answers1

1

It works for me with pyperclip-1.5.27. With this script, test.py:

import pyperclip
pyperclip.copy('The text to be copied to the clipboard.')

$>python ./test.py

Then doing Ctrl+V pastes:

The text to be copied to the clipboard.

Are you sure pyperclip.copy is running or is your script more complex than that?

aless80
  • 3,122
  • 3
  • 34
  • 53
  • As is said I use `parcellite` with AwesomeWM. It might work for you, because it might be handled automatically. It should work in my case as well, only for some reason it doesn't work if I execute it in a script. – Sheldan Mar 25 '16 at 23:56