1

Currently i am working on a little application which deals with the pyperclip module.

First of all, my setup:

ubuntu 16.04 | python3 | pyperclip 1.6.0 (newest! 2017-11-08)

Situation 1:

When i run my python script directly:

python3 app.py

it all works fine!

Situation 2:

When i first build my app via pyinstaller and after run the app:

pyinstaller --onefile --name app app.py

./app

it all works fine!

Situation 3:

When i build my app and run it via systemd:

[Unit]
After=network.target

[Service]
ExecStart=/absolute/path/to/executable

[Install]
WantedBy=multi-user.target

i start the new service and check logs via journalctl, i get:

pyperclip.PyperclipException pyperclip could not find a copy/paste mechanism for your system

Soooo.. i know there are some issues for linux user and i exactly followed instruction and installed all missing modules:

sudo apt-get install xclip xsel -y

Issue still remaining...

Can anybody explain why i can run my executable directly in terminal but not via systemd?

Thanks and Greetings!

Creative crypter
  • 1,348
  • 6
  • 30
  • 67
  • Might be a stupid question, but are `xclip` and `xsel` installed in /usr/bin/? or /usr/local/bin/? I know my scheduled tasks had to be explicitly stated /usr/local/bin/python3 so I'd assume system fired tasks are always looking for executables in /usr/bin. – r.ook Jan 12 '18 at 16:00
  • they are all in /usr/bin why? how should i proceed? – Creative crypter Jan 12 '18 at 16:14
  • Sorry then I'm not sure. I'm not familiar enough with ubuntu/linux. – r.ook Jan 12 '18 at 17:09
  • am i really alone with this issue? why cant i get my service starting properly... – Creative crypter Jan 12 '18 at 19:32
  • Have you tried installing the rest of the modules listed here and give it another try? https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error – r.ook Jan 12 '18 at 19:38
  • In any case, if all else fails, google is your best friend: https://www.google.ca/search?q=pyperclip+could+not+find+a+copy%2Fpaste+mechanism+for+your+system&oq=pyperclip+could+not+find+a+copy%2Fpaste+mechanism+for+your+system&aqs=chrome..69i57.823j0j7&sourceid=chrome&ie=UTF-8 – r.ook Jan 12 '18 at 19:40
  • man... i did all of this. the PROBLEM still is: when i run the executable directly, it works. When i run it via systemd service file, it fails. any suggestions? – Creative crypter Jan 12 '18 at 19:49
  • maybe this answer applies can solve your problem too? https://stackoverflow.com/a/73145297/544947 – knocte Aug 01 '22 at 05:07

0 Answers0