The following python script successfully copies a given string into the clipboard when run from Ubuntu shell:
import os
text = 'The text to be copied to the clipboard.'
os.system("echo -n {s} | xsel -b".format(s=text))
However, when I execute the script from Emacs as follows, it does not work:
(call-process-shell-command "clipboard.py &" nil 0)
What is special about the script run with call-process-shell-command
and how do I work around the problem so my Python script would be able to use the clipboard?
EDIT: In addition, (shell-command-to-string "python clipboard.py")
freezes.